Skip to content

Commit

Permalink
docs: Generate CLI documentation (kubeflow#105)
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <gaoce@caicloud.io>
  • Loading branch information
gaocegege authored and k8s-ci-robot committed Jun 5, 2018
1 parent 1879497 commit 838943a
Show file tree
Hide file tree
Showing 38 changed files with 712 additions and 196 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __pycache__/
# Project specific ignore files
*.swp
bin
/katib-cli

# Go ignore files
## Binaries for programs and plugins
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ Katib provides a Web UI based on ModelDB(https://github.com/mitdbg/modeldb). The

![katib-demo](https://user-images.githubusercontent.com/10014831/38241910-64fb0646-376e-11e8-8b98-c26e577f3935.gif)

## CLI Documentation

Please refer to [katib-cli.md](./docs/CLI/katib-cli.md).

## CONTRIBUTING

Please feel free to test the system! [developer-guide.md](./docs/developer-guide.md) is a good starting point for developers.
Please feel free to test the system! [developer-guide.md](./docs/developer-guide.md) is a good starting point for developers.

## TODOs

Expand Down
19 changes: 17 additions & 2 deletions cmd/cli/create-study.go → cmd/cli/command/create-study.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
package main
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"context"
"fmt"
"io/ioutil"
"log"

"github.com/kubeflow/katib/pkg/api"
"github.com/spf13/cobra"
"google.golang.org/grpc"
yaml "gopkg.in/yaml.v2"

"github.com/kubeflow/katib/pkg/api"
)

type createStudyOpt struct {
Expand Down
32 changes: 32 additions & 0 deletions cmd/cli/command/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"github.com/spf13/cobra"
)

//NewCommandCreate generate create cmd
func NewCommandCreate() *cobra.Command {
cmd := &cobra.Command{
Use: "create",
Short: "Create a resource from a file",
Long: `YAML formats are accepted.`,
}

cmd.AddCommand(NewCommandCreateStudy())

return cmd
}
19 changes: 17 additions & 2 deletions cmd/cli/get-model.go → cmd/cli/command/get-model.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package main
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"context"
Expand All @@ -9,9 +23,10 @@ import (
"text/tabwriter"
"unicode/utf8"

"github.com/kubeflow/katib/pkg/api"
"github.com/spf13/cobra"
"google.golang.org/grpc"

"github.com/kubeflow/katib/pkg/api"
)

type getModelOpt struct {
Expand Down
19 changes: 17 additions & 2 deletions cmd/cli/get-study.go → cmd/cli/command/get-study.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package main
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"context"
Expand All @@ -9,9 +23,10 @@ import (
"text/tabwriter"
"unicode/utf8"

"github.com/kubeflow/katib/pkg/api"
"github.com/spf13/cobra"
"google.golang.org/grpc"

"github.com/kubeflow/katib/pkg/api"
)

//NewCommandGetStudy generate get studies cmd
Expand Down
37 changes: 37 additions & 0 deletions cmd/cli/command/get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"github.com/spf13/cobra"
)

//NewCommandGet generate get cmd
func NewCommandGet() *cobra.Command {
cmd := &cobra.Command{
Use: "get",
Short: "Display one or many resources",
Long: `list of resorces comannd can display includes: studies, study, trials, trial, models, model`,
}

//set local flag

//add subcommand
cmd.AddCommand(NewCommandGetStudy())
// cmd.AddCommand(NewCommandGetTrial())
cmd.AddCommand(NewCommandGetModel())

return cmd
}
19 changes: 17 additions & 2 deletions cmd/cli/pull-study.go → cmd/cli/command/pull-study.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package main
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"context"
Expand All @@ -9,10 +23,11 @@ import (
"strings"
"unicode/utf8"

"github.com/kubeflow/katib/pkg/api"
"github.com/spf13/cobra"
"google.golang.org/grpc"
yaml "gopkg.in/yaml.v2"

"github.com/kubeflow/katib/pkg/api"
)

type pullStudyOpt struct {
Expand Down
33 changes: 33 additions & 0 deletions cmd/cli/command/pull.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"github.com/spf13/cobra"
)

//NewCommandPull generate run cmd
func NewCommandPull() *cobra.Command {
cmd := &cobra.Command{
Use: "pull",
Short: "Pull a resource from a file or from stdin.",
Long: `YAML or JSON formats are accepted.`,
}

cmd.AddCommand(NewCommandPullStudy())
// cmd.AddCommand(NewCommandPullModel())

return cmd
}
19 changes: 17 additions & 2 deletions cmd/cli/push-model.go → cmd/cli/command/push-model.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package main
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"context"
Expand All @@ -7,10 +21,11 @@ import (
"io/ioutil"
"log"

"github.com/kubeflow/katib/pkg/api"
"github.com/spf13/cobra"
"google.golang.org/grpc"
yaml "gopkg.in/yaml.v2"

"github.com/kubeflow/katib/pkg/api"
)

type pushModelOpt struct {
Expand Down
19 changes: 17 additions & 2 deletions cmd/cli/push-study.go → cmd/cli/command/push-study.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package main
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"context"
Expand All @@ -7,10 +21,11 @@ import (
"io/ioutil"
"log"

"github.com/kubeflow/katib/pkg/api"
"github.com/spf13/cobra"
"google.golang.org/grpc"
yaml "gopkg.in/yaml.v2"

"github.com/kubeflow/katib/pkg/api"
)

type pushStudyOpt struct {
Expand Down
32 changes: 32 additions & 0 deletions cmd/cli/command/push.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"github.com/spf13/cobra"
)

//NewCommandPush generate run cmd
func NewCommandPush() *cobra.Command {
cmd := &cobra.Command{
Use: "push",
Short: "Push a resource from a file or from stdin.",
Long: `YAML or JSON formats are accepted.`,
}

cmd.AddCommand(NewCommandPushStudy())

return cmd
}
16 changes: 15 additions & 1 deletion cmd/cli/root.go → cmd/cli/command/root.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package main
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package command

import (
"errors"
Expand Down

0 comments on commit 838943a

Please sign in to comment.