From 90e2e053d25feabd2dcf384dfc262a8bcdbe3ab8 Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Sat, 5 Mar 2022 12:53:15 -0700 Subject: Initial Commit --- termshare/cmd/daemon.go | 25 +++++++++++++++++++++++++ termshare/cmd/root.go | 16 ++++++++++++++++ termshare/cmd/version.go | 24 ++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 termshare/cmd/daemon.go create mode 100644 termshare/cmd/root.go create mode 100644 termshare/cmd/version.go (limited to 'termshare/cmd') diff --git a/termshare/cmd/daemon.go b/termshare/cmd/daemon.go new file mode 100644 index 0000000..3ae3f39 --- /dev/null +++ b/termshare/cmd/daemon.go @@ -0,0 +1,25 @@ +package cmd + +import ( + "termshare/internal/daemon" + + "github.com/spf13/cobra" +) + +var ( + flagPort string +) + +func init() { + cmd := &cobra.Command{ + Use: "daemon", + Short: "Run the daemon command", + Long: "run the daemon command", + Run: func(cmd *cobra.Command, args []string) { + daemon.RunDaemon(flagPort) + }, + } + cmd.PersistentFlags().StringVarP(&flagPort, "port", "", "8080", "The port the daemon should listen to") + rootCmd.AddCommand(cmd) +} + diff --git a/termshare/cmd/root.go b/termshare/cmd/root.go new file mode 100644 index 0000000..848dac7 --- /dev/null +++ b/termshare/cmd/root.go @@ -0,0 +1,16 @@ +package cmd + +import ( + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "Termshare", + Short: "A terminal sharing application", + Long: "A super fun time application to share terminals", +} + +// Execute executes the root command. +func Execute() error { + return rootCmd.Execute() +} diff --git a/termshare/cmd/version.go b/termshare/cmd/version.go new file mode 100644 index 0000000..bc529cc --- /dev/null +++ b/termshare/cmd/version.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +func init() { + rootCmd.AddCommand(versionCmd) +} + +func run(cmd *cobra.Command, args []string) { + fmt.Println("0.0.1") +} + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Print the version of termshare", + Long: "This is the version of the termshare command", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("0.0.1") + }, +} -- cgit v1.2.3