Skip to content

Commit

Permalink
Merge pull request #7 from mikkelhegn/print_all
Browse files Browse the repository at this point in the history
Print all the things!
  • Loading branch information
asteurer authored Sep 17, 2024
2 parents 7666def + 97d066d commit c83051c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ func Execute() {
}
}

var All bool

func init() {
showCmd.PersistentFlags().StringP("file", "f", "", "Specifies the path to the spin.toml file you wish to visualize")
showCmd.PersistentFlags().StringP("env", "e", "", "Specifies the path to the \".env\" file containing your Spin variables")
showCmd.PersistentFlags().BoolVarP(&All, "all", "a", false, "Output information about all component. Only applies if no component name is specified.")
rootCmd.AddCommand(showCmd)
}
7 changes: 7 additions & 0 deletions cmd/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ By default, the command looks for a "spin.toml" file in the current directory.`,
// This won't throw errors because we are not checking the validity of a "spin.toml" file
fmt.Print(showAllComponents(tomlData, envVars))

// Also print info about all components if --all flag is set
if All {
for name, _ := range tomlData.Component {
fmt.Print(showSpecificComponent(tomlData, envVars, name))
}
}

} else {
terminalOutput, err := showSpecificComponent(tomlData, envVars, args[0])
if err != nil {
Expand Down

0 comments on commit c83051c

Please sign in to comment.