Skip to content

Commit

Permalink
feat(cmd): add a flag to the root command called limit as an option f…
Browse files Browse the repository at this point in the history
…or the user to set up the limit value

86
  • Loading branch information
danvergara committed Dec 22, 2021
1 parent 0b183c4 commit dd2c852
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dblab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ database:
password: "password"
user: "postgres"
driver: "postgres"
limit: 50
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
pass string
db string
ssl string
limit int
)

// NewRootCmd returns the root command.
Expand Down Expand Up @@ -48,6 +49,7 @@ func NewRootCmd() *cobra.Command {
Pass: pass,
DBName: db,
SSL: ssl,
Limit: limit,
}

if form.IsEmpty(opts) {
Expand Down Expand Up @@ -106,4 +108,5 @@ func init() {
rootCmd.Flags().StringVarP(&pass, "pass", "", "", "Password for user")
rootCmd.Flags().StringVarP(&db, "db", "", "", "Database name")
rootCmd.Flags().StringVarP(&ssl, "ssl", "", "", "SSL mode")
rootCmd.Flags().IntVarP(&limit, "limit", "", 100, "Size of the result set from the table content query")
}

0 comments on commit dd2c852

Please sign in to comment.