Skip to content

Commit 97d066d

Browse files
committed
Adding --all flag to output all the things
Signed-off-by: Mikkel Mørk Hegnhøj <[email protected]>
1 parent ff2a699 commit 97d066d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ var All bool
2424
func init() {
2525
showCmd.PersistentFlags().StringP("file", "f", "", "Specifies the path to the spin.toml file you wish to visualize")
2626
showCmd.PersistentFlags().StringP("env", "e", "", "Specifies the path to the \".env\" file containing your Spin variables")
27-
showCmd.PersistentFlags().BoolVarP(&All, "all", "a", false, "Output information about all component. Only applies if no component name is specified.")
27+
showCmd.PersistentFlags().BoolVarP(&All, "all", "a", false, "Output information about all component. Only applies if no component name is specified.")
2828
rootCmd.AddCommand(showCmd)
2929
}

cmd/show.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var showCmd = &cobra.Command{
2020
Long: `The "show" command reads a spin.toml file and prints a table of components to the terminal.
2121
You can optionally specify a component to display information for a specific component only.
2222
By default, the command looks for a "spin.toml" file in the current directory.`,
23-
Args: cobra.MaximumNArgs(2),
23+
Args: cobra.MaximumNArgs(1),
2424
RunE: func(cmd *cobra.Command, args []string) error {
2525
// The path to a "spin.toml" file
2626
path, err := cmd.Flags().GetString("file")
@@ -59,12 +59,12 @@ By default, the command looks for a "spin.toml" file in the current directory.`,
5959
// This won't throw errors because we are not checking the validity of a "spin.toml" file
6060
fmt.Print(showAllComponents(tomlData, envVars))
6161

62-
// Also print info about all components if --all flag is set
63-
if All {
64-
for name, _ := range tomlData.Component {
65-
fmt.Print(showSpecificComponent(tomlData, envVars, name))
66-
}
67-
}
62+
// Also print info about all components if --all flag is set
63+
if All {
64+
for name, _ := range tomlData.Component {
65+
fmt.Print(showSpecificComponent(tomlData, envVars, name))
66+
}
67+
}
6868

6969
} else {
7070
terminalOutput, err := showSpecificComponent(tomlData, envVars, args[0])

0 commit comments

Comments
 (0)