Skip to content

Commit

Permalink
Merge pull request #36 from gauravgahlot/issue-3-cli-root
Browse files Browse the repository at this point in the history
Rename the root CLI command from tinkerbell to tink
  • Loading branch information
nathangoulding authored and mmlb committed Apr 21, 2020
2 parents 7161f4d + 7f57669 commit cf30be0
Show file tree
Hide file tree
Showing 48 changed files with 116 additions and 116 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tinkerbell-server
**/tinkerbell-cli
**/tinkerbell-worker
tink-server
**/tink-cli
**/tink-worker
bin/
certs/

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ${server}:
CGO_ENABLED=0 go build -o $@ .

${cli}:
CGO_ENABLED=0 go build -o ./cmd/tinkerbell/$@ ./cmd/tinkerbell
CGO_ENABLED=0 go build -o ./cli/tink/$@ ./cli/tink

${worker}:
CGO_ENABLED=0 go build -o ./worker/$@ ./worker/
Expand Down
2 changes: 1 addition & 1 deletion cmd/tinkerbell/Dockerfile → cli/tink/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ FROM alpine:3.7
CMD sleep 60d

RUN apk add --no-cache --update --upgrade ca-certificates
COPY tinkerbell-cli /bin/tinkerbell
COPY tink-cli /bin/tink
COPY sample.tmpl /tmp
6 changes: 3 additions & 3 deletions cmd/tinkerbell/cmd/hardware.go → cli/tink/cmd/hardware.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package cmd
import (
"fmt"

"github.com/tinkerbell/tink/cmd/tinkerbell/cmd/hardware"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/cli/tink/cmd/hardware"
)

var hardwareCmd = &cobra.Command{
Use: "hardware",
Short: "tinkerbell hardware client",
Example: "tinkerbell hardware [command]",
Short: "tink hardware client",
Example: "tink hardware [command]",
Args: func(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("%v requires arguments", c.UseLine())
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"fmt"
"log"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/hardware"
"github.com/spf13/cobra"
)

// idCmd represents the id command
var idCmd = &cobra.Command{
Use: "id",
Short: "Get hardware by id",
Example: "tinkerbell hardware id 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Example: "tink hardware id 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Args: func(_ *cobra.Command, args []string) error {
return verifyUUIDs(args)
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"log"
"net"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/hardware"
"github.com/spf13/cobra"
)

// ipCmd represents the ip command
var ipCmd = &cobra.Command{
Use: "ip",
Short: "Get hardware by any associated ip",
Example: "tinkerbell hardware ip 10.0.0.2 10.0.0.3",
Example: "tink hardware ip 10.0.0.2 10.0.0.3",
Args: func(_ *cobra.Command, args []string) error {
for _, arg := range args {
if net.ParseIP(arg) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"log"
"net"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/hardware"
"github.com/spf13/cobra"
)

// macCmd represents the mac command
var macCmd = &cobra.Command{
Use: "mac",
Short: "Get hardware by any associated mac",
Example: "tinkerbell hardware mac 00:00:00:00:00:01 00:00:00:00:00:02",
Example: "tink hardware mac 00:00:00:00:00:01 00:00:00:00:00:02",
Args: func(_ *cobra.Command, args []string) error {
for _, arg := range args {
if _, err := net.ParseMAC(arg); err != nil {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
"log"
"sync"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/hardware"
"github.com/spf13/cobra"
)

// watchCmd represents the watch command
var watchCmd = &cobra.Command{
Use: "watch",
Short: "Register to watch an id for any changes",
Example: "tinkerbell hardware watch 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Example: "tink hardware watch 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Args: func(_ *cobra.Command, args []string) error {
return verifyUUIDs(args)
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/tinkerbell/cmd/root.go → cli/tink/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import (
"fmt"
"os"

"github.com/tinkerbell/tink/client"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tinkerbell/tink/client"
)

var cfgFile string

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "tinkerbell",
Short: "tinkerbell client",
Use: "tink",
Short: "tinkerbell CLI",
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
6 changes: 3 additions & 3 deletions cmd/tinkerbell/cmd/target.go → cli/tink/cmd/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package cmd
import (
"fmt"

"github.com/tinkerbell/tink/cmd/tinkerbell/cmd/target"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/cli/tink/cmd/target"
)

// templateCmd represents the template sub-command
var targetCmd = &cobra.Command{
Use: "target",
Short: "tinkerbell target client",
Example: "tinkerbell target [command]",
Short: "tink target client",
Example: "tink target [command]",
Args: func(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("%v requires arguments", c.UseLine())
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import (
"context"
"log"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/target"
"github.com/spf13/cobra"
)

// idCmd represents the id command
var deleteCmd = &cobra.Command{
Use: "delete",
Short: "delete a target",
Example: "tinkerbell target delete 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Example: "tink target delete 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Args: func(_ *cobra.Command, args []string) error {
return verifyUUIDs(args)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"fmt"
"log"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/target"
"github.com/spf13/cobra"
)

// idCmd represents the id command
var getCmd = &cobra.Command{
Use: "get",
Short: "get a target",
Example: "tinkerbell target get 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Example: "tink target get 224ee6ab-ad62-4070-a900-ed816444cec0 cb76ae54-93e9-401c-a5b2-d455bb3800b1",
Args: func(_ *cobra.Command, args []string) error {
return verifyUUIDs(args)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"os"

"github.com/jedib0t/go-pretty/table"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/target"
"github.com/spf13/cobra"
)

// listCmd represents the list subcommand for target command
var listCmd = &cobra.Command{
Use: "list",
Short: "list all targets",
Example: "tinkerbell target list",
Example: "tink target list",
Args: func(c *cobra.Command, args []string) error {
if len(args) != 0 {
return fmt.Errorf("%v takes no arguments", c.UseLine())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"log"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/target"
"github.com/spf13/cobra"
)

var (
Expand All @@ -21,7 +21,7 @@ var (
var updateCmd = &cobra.Command{
Use: "update",
Short: "update a target",
Example: "tinkerbell target update [flags]",
Example: "tink target update [flags]",
Run: func(c *cobra.Command, args []string) {
err := validateData(c, args)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions cmd/tinkerbell/cmd/template.go → cli/tink/cmd/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package cmd
import (
"fmt"

"github.com/tinkerbell/tink/cmd/tinkerbell/cmd/template"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/cli/tink/cmd/template"
)

// templateCmd represents the template sub-command
var templateCmd = &cobra.Command{
Use: "template",
Short: "tinkerbell template client",
Example: "tinkerbell template [command]",
Short: "tink template client",
Example: "tink template [command]",
Args: func(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("%v requires arguments", c.UseLine())
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
tt "text/template"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/template"
"github.com/spf13/cobra"
)

var (
Expand All @@ -24,7 +24,7 @@ var (
var createCmd = &cobra.Command{
Use: "create",
Short: "create a workflow template ",
Example: "tinkerbell template create [flags]",
Example: "tink template create [flags]",
Run: func(c *cobra.Command, args []string) {
validateTemplate()
createTemplate(c, args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import (
"fmt"
"log"

"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/template"
uuid "github.com/satori/go.uuid"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/template"
)

// deleteCmd represents the delete subcommand for template command
var deleteCmd = &cobra.Command{
Use: "delete [id]",
Short: "delete a template",
Example: "tinkerbell template delete [id]",
Example: "tink template delete [id]",
Args: func(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("%v requires an argument", c.UseLine())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import (
"fmt"
"log"

"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/template"
uuid "github.com/satori/go.uuid"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/template"
)

// getCmd represents the get subcommand for template command
var getCmd = &cobra.Command{
Use: "get [id]",
Short: "get a template",
Example: "tinkerbell template get [id]",
Example: "tink template get [id]",
Args: func(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("%v requires an argument", c.UseLine())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"time"

"github.com/jedib0t/go-pretty/table"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/template"
"github.com/spf13/cobra"
)

// table headers
Expand All @@ -26,7 +26,7 @@ var (
var listCmd = &cobra.Command{
Use: "list",
Short: "list all saved templates",
Example: "tinkerbell template list",
Example: "tink template list",
Args: func(c *cobra.Command, args []string) error {
if len(args) != 0 {
return fmt.Errorf("%v takes no arguments", c.UseLine())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import (
"fmt"
"log"

"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/template"
uuid "github.com/satori/go.uuid"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/template"
)

// updateCmd represents the get subcommand for template command
var updateCmd = &cobra.Command{
Use: "update [id] [flags]",
Short: "update a template",
Example: "tinkerbell template update [id] [flags]",
Example: "tink template update [id] [flags]",
PreRunE: func(c *cobra.Command, args []string) error {
name, _ := c.Flags().GetString(fName)
path, _ := c.Flags().GetString(fPath)
Expand Down
6 changes: 3 additions & 3 deletions cmd/tinkerbell/cmd/workflow.go → cli/tink/cmd/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package cmd
import (
"fmt"

"github.com/tinkerbell/tink/cmd/tinkerbell/cmd/workflow"
"github.com/spf13/cobra"
"github.com/tinkerbell/tink/cli/tink/cmd/workflow"
)

// workflowCmd represents the workflow sub-command
var workflowCmd = &cobra.Command{
Use: "workflow",
Short: "tinkerbell workflow client",
Example: "tinkerbell workflow [command]",
Short: "tink workflow client",
Example: "tink workflow [command]",
Args: func(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("%v requires arguments", c.UseLine())
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"log"

"github.com/spf13/cobra"
"github.com/tinkerbell/tink/client"
"github.com/tinkerbell/tink/protos/workflow"
"github.com/spf13/cobra"
)

var (
Expand All @@ -21,7 +21,7 @@ var (
var createCmd = &cobra.Command{
Use: "create",
Short: "create a workflow",
Example: "tinkerbell workflow create [flags]",
Example: "tink workflow create [flags]",
PreRunE: func(c *cobra.Command, args []string) error {
tmp, _ := c.Flags().GetString(fTemplate)
err := validateID(tmp)
Expand Down
Loading

0 comments on commit cf30be0

Please sign in to comment.