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

feat(influx): add hide headers flag to influx cli task cmd #16345

Merged
merged 1 commit into from
Dec 27, 2019
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
1. [16338](https://github.com/influxdata/influxdb/pull/16338): Add last run status to check and notification rules
1. [16340](https://github.com/influxdata/influxdb/pull/16340): Add last run status to tasks
1. [16341](https://github.com/influxdata/influxdb/pull/16341): Extend pkger apply functionality with ability to provide secrets outside of pkg
1. [16345](https://github.com/influxdata/influxdb/pull/16345): Add hide headers flag to influx cli task find cmd

### Bug Fixes

Expand Down
59 changes: 19 additions & 40 deletions cmd/influx/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,28 @@ func taskF(cmd *cobra.Command, args []string) error {
var logCmd = &cobra.Command{
Use: "log",
Short: "Log related commands",
Run: logF,
}

func logF(cmd *cobra.Command, args []string) {
cmd.Usage()
Run: func(cmd *cobra.Command, args []string) {
cmd.Usage()
},
}

var runCmd = &cobra.Command{
Use: "run",
Short: "Run related commands",
Run: runF,
}

func runF(cmd *cobra.Command, args []string) {
cmd.Usage()
Run: func(cmd *cobra.Command, args []string) {
cmd.Usage()
},
}

func init() {
taskCmd.AddCommand(runCmd)
taskCmd.AddCommand(logCmd)
}

// TaskCreateFlags define the Create Command
type TaskCreateFlags struct {
var taskCreateFlags struct {
organization
}

var taskCreateFlags TaskCreateFlags

func init() {
taskCreateCmd := &cobra.Command{
Use: "create [query literal or @/path/to/query.flux]",
Expand Down Expand Up @@ -137,16 +130,14 @@ func taskCreateF(cmd *cobra.Command, args []string) error {
return nil
}

// taskFindFlags define the Find Command
type TaskFindFlags struct {
user string
id string
limit int
var taskFindFlags struct {
user string
id string
limit int
headers bool
organization
}

var taskFindFlags TaskFindFlags

func init() {
taskFindCmd := &cobra.Command{
Use: "find",
Expand All @@ -158,6 +149,7 @@ func init() {
taskFindCmd.Flags().StringVarP(&taskFindFlags.user, "user-id", "n", "", "task owner ID")
taskFindFlags.organization.register(taskFindCmd)
taskFindCmd.Flags().IntVarP(&taskFindFlags.limit, "limit", "", platform.TaskDefaultPageSize, "the number of tasks to find")
taskFindCmd.Flags().BoolVar(&taskFindFlags.headers, "headers", true, "To print the table headers; defaults true")

taskCmd.AddCommand(taskFindCmd)
}
Expand Down Expand Up @@ -220,6 +212,7 @@ func taskFindF(cmd *cobra.Command, args []string) error {
}

w := internal.NewTabWriter(os.Stdout)
w.HideHeaders(!taskFindFlags.headers)
w.WriteHeaders(
"ID",
"Name",
Expand All @@ -246,14 +239,11 @@ func taskFindF(cmd *cobra.Command, args []string) error {
return nil
}

// taskUpdateFlags define the Update Command
type TaskUpdateFlags struct {
var taskUpdateFlags struct {
id string
status string
}

var taskUpdateFlags TaskUpdateFlags

func init() {
taskUpdateCmd := &cobra.Command{
Use: "update",
Expand Down Expand Up @@ -323,13 +313,10 @@ func taskUpdateF(cmd *cobra.Command, args []string) error {
return nil
}

// taskDeleteFlags define the Delete command
type TaskDeleteFlags struct {
var taskDeleteFlags struct {
id string
}

var taskDeleteFlags TaskDeleteFlags

func init() {
taskDeleteCmd := &cobra.Command{
Use: "delete",
Expand Down Expand Up @@ -391,14 +378,11 @@ func taskDeleteF(cmd *cobra.Command, args []string) error {
return nil
}

// taskLogFindFlags define the Delete command
type TaskLogFindFlags struct {
var taskLogFindFlags struct {
taskID string
runID string
}

var taskLogFindFlags TaskLogFindFlags

func init() {
taskLogFindCmd := &cobra.Command{
Use: "find",
Expand Down Expand Up @@ -459,17 +443,14 @@ func taskLogFindF(cmd *cobra.Command, args []string) error {
return nil
}

// taskLogFindFlags define the Delete command
type TaskRunFindFlags struct {
var taskRunFindFlags struct {
runID string
taskID string
afterTime string
beforeTime string
limit int
}

var taskRunFindFlags TaskRunFindFlags

func init() {
taskRunFindCmd := &cobra.Command{
Use: "find",
Expand Down Expand Up @@ -556,12 +537,10 @@ func taskRunFindF(cmd *cobra.Command, args []string) error {
return nil
}

type RunRetryFlags struct {
var runRetryFlags struct {
taskID, runID string
}

var runRetryFlags RunRetryFlags

func init() {
cmd := &cobra.Command{
Use: "retry",
Expand Down