Skip to content

Commit

Permalink
refactor: update help
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamidullah committed Dec 13, 2018
1 parent f03b633 commit fe8c354
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
6 changes: 4 additions & 2 deletions cmd/cmd_airtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ func (cmd *airtableCommand) ParseFlags(flags *pflag.FlagSet) {

func (cmd *airtableCommand) NewCobraCommand(dc map[string]DepvizCommand) *cobra.Command {
cc := &cobra.Command{
Use: "airtable",
Use: "airtable",
Short: "Upload issue info stored in database to airtable spreadsheets",
}
cc.AddCommand(cmd.airtableSyncCommand())
return cc
}

func (cmd *airtableCommand) airtableSyncCommand() *cobra.Command {
cc := &cobra.Command{
Use: "sync",
Use: "sync",
Short: "Upload issue info stored in database to airtable spreadsheets",
RunE: func(_ *cobra.Command, args []string) error {
opts := cmd.opts
var err error
Expand Down
7 changes: 4 additions & 3 deletions cmd/cmd_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"encoding/json"
"fmt"
"moul.io/depviz/pkg/issues"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"moul.io/depviz/pkg/issues"
)

type dbOptions struct{}
Expand Down Expand Up @@ -42,7 +42,8 @@ func (cmd *dbCommand) ParseFlags(flags *pflag.FlagSet) {

func (cmd *dbCommand) dbDumpCommand() *cobra.Command {
cc := &cobra.Command{
Use: "dump",
Use: "dump",
Short: "Print all issues stored in the database, formatted as JSON",
RunE: func(_ *cobra.Command, args []string) error {
opts := cmd.opts
return dbDump(&opts)
Expand All @@ -68,4 +69,4 @@ func dbDump(opts *dbOptions) error {
}
fmt.Println(string(out))
return nil
}
}
3 changes: 2 additions & 1 deletion cmd/cmd_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ func (cmd *graphCommand) ParseFlags(flags *pflag.FlagSet) {

func (cmd *graphCommand) NewCobraCommand(dc map[string]DepvizCommand) *cobra.Command {
cc := &cobra.Command{
Use: "graph",
Use: "graph",
Short: "Output graph of relationships between all issues stored in database",
RunE: func(_ *cobra.Command, args []string) error {
opts := cmd.opts
var err error
Expand Down
3 changes: 2 additions & 1 deletion cmd/cmd_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ func (cmd *pullCommand) ParseFlags(flags *pflag.FlagSet) {

func (cmd *pullCommand) NewCobraCommand(dc map[string]DepvizCommand) *cobra.Command {
cc := &cobra.Command{
Use: "pull",
Use: "pull",
Short: "Pull issues and update database without outputting graph",
RunE: func(_ *cobra.Command, args []string) error {
opts := cmd.opts
var err error
Expand Down
3 changes: 2 additions & 1 deletion cmd/cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func (cmd *runCommand) ParseFlags(flags *pflag.FlagSet) {

func (cmd *runCommand) NewCobraCommand(dc map[string]DepvizCommand) *cobra.Command {
cc := &cobra.Command{
Use: "run",
Use: "run",
Short: "Pull issues, update database, and output a graph of relationships between issues",
RunE: func(_ *cobra.Command, args []string) error {
opts := cmd.opts
opts.GraphOptions = dc["graph"].(*graphCommand).opts
Expand Down
3 changes: 2 additions & 1 deletion cmd/cmd_web.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func (cmd *webCommand) ParseFlags(flags *pflag.FlagSet) {

func (cmd *webCommand) NewCobraCommand(dc map[string]DepvizCommand) *cobra.Command {
cc := &cobra.Command{
Use: "web",
Use: "web",
Short: "Run depviz as a web server",
RunE: func(_ *cobra.Command, args []string) error {
opts := cmd.opts
return web(&opts)
Expand Down

0 comments on commit fe8c354

Please sign in to comment.