Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print all the things! #7

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading