Skip to content
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
36 changes: 19 additions & 17 deletions cmd/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/MakeNowJust/heredoc"
"github.com/odpf/salt/printer"
"github.com/odpf/salt/term"
stencilv1beta1 "github.com/odpf/stencil/server/odpf/stencil/v1beta1"
"github.com/spf13/cobra"
"google.golang.org/grpc"
Expand All @@ -17,12 +18,12 @@ func NamespaceCmd() *cobra.Command {
Use: "namespace",
Aliases: []string{"namespace"},
Short: "Manage namespace",
Long: "Work with namespaces",
Long: "Work with namespaces.",
Example: heredoc.Doc(`
$ stencil namespace list
$ stencil namespace create
$ stencil namespace get
$ stencil namespace update
$ stencil namespace view
$ stencil namespace edit
$ stencil namespace delete
`),
Annotations: map[string]string{
Expand Down Expand Up @@ -55,6 +56,7 @@ func listNamespaceCmd() *cobra.Command {
"group:core": "true",
},
RunE: func(cmd *cobra.Command, args []string) error {
cs := term.NewColorScheme()
s := printer.Spin("")
defer s.Stop()

Expand All @@ -75,14 +77,14 @@ func listNamespaceCmd() *cobra.Command {

s.Stop()

fmt.Printf(" \nShowing %d namespaces \n", len(namespaces))
fmt.Printf(" \nShowing %[1]d of %[1]d namespaces \n \n", len(namespaces))

report = append(report, []string{"NAMESPACE"})
report = append(report, []string{"INDEX", "NAMESPACE", "FORMAT", "COMPATIBILITY", "DESCRIPTION"})
index := 1

for _, n := range namespaces {
report = append(report, []string{
n,
})
report = append(report, []string{cs.Greenf("#%02d", index), n, "-", "-", "-"})
index++
}
printer.Table(os.Stdout, report)
return nil
Expand All @@ -105,7 +107,7 @@ func createNamespaceCmd() *cobra.Command {
Short: "Create a namespace",
Args: cobra.ExactArgs(1),
Example: heredoc.Doc(`
$ stencil namespace create <namespace-id> --format=<schema-format> –-comp=<schema-compatibility> -desc=<description>
$ stencil namespace create <namespace-id> --format=<schema-format> --comp=<schema-compatibility> --desc=<description>
`),
Annotations: map[string]string{
"group:core": "true",
Expand Down Expand Up @@ -137,7 +139,7 @@ func createNamespaceCmd() *cobra.Command {

spinner.Stop()

fmt.Printf("namespace successfully created with id: %s", namespace.GetId())
fmt.Printf("Namespace successfully created with id: %s", namespace.GetId())
return nil
},
}
Expand All @@ -162,11 +164,11 @@ func updateNamespaceCmd() *cobra.Command {
var req stencilv1beta1.UpdateNamespaceRequest

cmd := &cobra.Command{
Use: "update",
Short: "Update a namespace",
Use: "edit",
Short: "Edit a namespace",
Args: cobra.ExactArgs(1),
Example: heredoc.Doc(`
$ stencil namespace update <namespace-id> –-format=<schema-format> –-comp=<schema-compatibility> -desc=<description>
$ stencil namespace edit <namespace-id> --format=<schema-format> --comp=<schema-compatibility> --desc=<description>
`),
Annotations: map[string]string{
"group:core": "true",
Expand Down Expand Up @@ -196,7 +198,7 @@ func updateNamespaceCmd() *cobra.Command {

spinner.Stop()

fmt.Printf("namespace successfully updated")
fmt.Printf("Namespace successfully updated")
return nil
},
}
Expand All @@ -221,11 +223,11 @@ func getNamespaceCmd() *cobra.Command {
var req stencilv1beta1.GetNamespaceRequest

cmd := &cobra.Command{
Use: "get",
Use: "view",
Short: "View a namespace",
Args: cobra.ExactArgs(1),
Example: heredoc.Doc(`
$ stencil namespace get <namespace-id>
$ stencil namespace view <namespace-id>
`),
Annotations: map[string]string{
"group:core": "true",
Expand Down Expand Up @@ -310,7 +312,7 @@ func deleteNamespaceCmd() *cobra.Command {

spinner.Stop()

fmt.Printf("namespace successfully deleted")
fmt.Printf("Namespace successfully deleted")

return nil
},
Expand Down
12 changes: 6 additions & 6 deletions cmd/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func SchemaCmd() *cobra.Command {
Example: heredoc.Doc(`
$ stencil schema list
$ stencil schema create
$ stencil schema get
$ stencil schema update
$ stencil schema view
$ stencil schema edit
$ stencil schema delete
$ stencil schema version
$ stencil schema graph
Expand Down Expand Up @@ -202,11 +202,11 @@ func updateSchemaCmd() *cobra.Command {
var req stencilv1beta1.UpdateSchemaMetadataRequest

cmd := &cobra.Command{
Use: "update",
Use: "edit",
Short: "Edit a schema",
Args: cobra.ExactArgs(1),
Example: heredoc.Doc(`
$ stencil schema update <schema-id> --namespace=<namespace-id> -comp=<schema-compatibility>
$ stencil schema edit <schema-id> --namespace=<namespace-id> --comp=<schema-compatibility>
`),
Annotations: map[string]string{
"group:core": "true",
Expand Down Expand Up @@ -260,11 +260,11 @@ func getSchemaCmd() *cobra.Command {
var resMetadata *stencilv1beta1.GetSchemaMetadataResponse

cmd := &cobra.Command{
Use: "get",
Use: "view",
Short: "View a schema",
Args: cobra.ExactArgs(1),
Example: heredoc.Doc(`
$ stencil schema get <schema-id> --namespace=<namespace-id> --version <version> --metadata <metadata>
$ stencil schema view <schema-id> --namespace=<namespace-id> --version <version> --metadata <metadata>
`),
Annotations: map[string]string{
"group:core": "true",
Expand Down
2 changes: 1 addition & 1 deletion cmd/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func SearchCmd() *cobra.Command {
var req stencilv1beta1.SearchRequest

cmd := &cobra.Command{
Use: "search",
Use: "search <query>",
Aliases: []string{"search"},
Short: "Search",
Long: "Search your queries on schemas",
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/1_quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ $ echo "{

```bash
# Create namespace named "quickstart" with backward compatibility enabled
$ stencil namespace create -c COMPATIBILITY_BACKWARD -f FORMAT_PROTOBUF -d "For quickstart guide" --host http://localhost:8000
$ stencil namespace create quickstart -c COMPATIBILITY_BACKWARD -f FORMAT_PROTOBUF -d "For quickstart guide" --host http://localhost:8000

# List namespaces
$ stencil namespace list
Expand Down
4 changes: 0 additions & 4 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
colorMode: {
defaultMode: 'light',
respectPrefersColorScheme: true,
switchConfig: {
darkIcon: '☾',
lightIcon: '☀️',
},
},
navbar: {
title: 'Stencil',
Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^0.0.0-4608",
"@docusaurus/plugin-google-gtag": "^2.0.0-beta.6",
"@docusaurus/preset-classic": "^0.0.0-4608",
"@docusaurus/core": "^2.0.0-beta.17",
"@docusaurus/plugin-google-gtag": "^2.0.0-beta.17",
"@docusaurus/preset-classic": "^2.0.0-beta.17",
"@mdx-js/react": "^1.6.21",
"@svgr/webpack": "^6.0.0",
"classnames": "^2.3.1",
Expand Down
Loading