feat: added context flag to make dev easier
needed until we have proper server subcommand system
This commit is contained in:
parent
b9e06f2310
commit
6c748922b4
|
@ -39,6 +39,7 @@ func RunApp(version, commit string) {
|
|||
BranchFlag,
|
||||
NoPromptFlag,
|
||||
DebugFlag,
|
||||
ContextFlag,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package cli
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
@ -176,3 +179,31 @@ var TypeFlag = &cli.StringFlag{
|
|||
Value: "",
|
||||
Destination: &Type,
|
||||
}
|
||||
|
||||
var Context string
|
||||
var ContextFlag = &cli.StringFlag{
|
||||
Name: "context",
|
||||
Value: "",
|
||||
Aliases: []string{"c"},
|
||||
Destination: &Context,
|
||||
}
|
||||
|
||||
func createTable(columns []string) *tablewriter.Table {
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
table.SetHeader(columns)
|
||||
|
||||
// Settings to create very bare tab padded table
|
||||
table.SetAutoWrapText(false)
|
||||
table.SetAutoFormatHeaders(true)
|
||||
table.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
|
||||
table.SetAlignment(tablewriter.ALIGN_LEFT)
|
||||
table.SetCenterSeparator("")
|
||||
table.SetColumnSeparator("")
|
||||
table.SetRowSeparator("")
|
||||
table.SetHeaderLine(false)
|
||||
table.SetBorder(false)
|
||||
table.SetTablePadding("\t") // pad with tabs
|
||||
table.SetNoWhiteSpace(true)
|
||||
table.SetColWidth(1)
|
||||
return table
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue