Skip to content

Commit c83051c

Browse files
authored
Merge pull request #7 from mikkelhegn/print_all
Print all the things!
2 parents 7666def + 97d066d commit c83051c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cmd/root.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ func Execute() {
1919
}
2020
}
2121

22+
var All bool
23+
2224
func init() {
2325
showCmd.PersistentFlags().StringP("file", "f", "", "Specifies the path to the spin.toml file you wish to visualize")
2426
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.")
2528
rootCmd.AddCommand(showCmd)
2629
}

cmd/show.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ 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+
}
68+
6269
} else {
6370
terminalOutput, err := showSpecificComponent(tomlData, envVars, args[0])
6471
if err != nil {

0 commit comments

Comments
 (0)