Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into issue-214-part1
Browse files Browse the repository at this point in the history
  • Loading branch information
prashanthpai authored Jul 9, 2018
2 parents 7fa266e + 8b192c7 commit 586016b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion glustercli/cmd/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ var (
flagCmdFilterKey string
flagCmdFilterValue string

//Filter Volume Get command flags
flagGetAdv bool
flagGetBsc bool
flagGetMdf bool

// Edit Command Flags
flagCmdMetadataKey string
flagCmdMetadataValue string
Expand All @@ -66,6 +71,9 @@ func init() {
// Volume Delete
volumeCmd.AddCommand(volumeDeleteCmd)

volumeGetCmd.Flags().BoolVar(&flagGetAdv, "advanced", false, "Get advanced options")
volumeGetCmd.Flags().BoolVar(&flagGetBsc, "basic", true, "Get basic options")
volumeGetCmd.Flags().BoolVar(&flagGetMdf, "modified", false, "Get modified options")
volumeCmd.AddCommand(volumeGetCmd)
volumeCmd.AddCommand(volumeResetCmd)
volumeCmd.AddCommand(volumeSizeCmd)
Expand Down Expand Up @@ -247,7 +255,17 @@ var volumeGetCmd = &cobra.Command{
table.SetAlignment(tablewriter.ALIGN_LEFT)

for _, opt := range opts {
table.Append([]string{opt.OptName, formatBoolYesNo(opt.Modified), opt.Value, opt.DefaultValue, opt.OptionLevel})
//if modified flag is set, discard unmodified options
if flagGetMdf && !opt.Modified {
continue
}
if flagGetBsc && opt.OptionLevel == "Basic" {
table.Append([]string{opt.OptName, formatBoolYesNo(opt.Modified), opt.Value, opt.DefaultValue, opt.OptionLevel})
}
if flagGetAdv && opt.OptionLevel == "Advanced" {
table.Append([]string{opt.OptName, formatBoolYesNo(opt.Modified), opt.Value, opt.DefaultValue, opt.OptionLevel})

}
}
table.Render()

Expand Down

0 comments on commit 586016b

Please sign in to comment.