summaryrefslogtreecommitdiff
path: root/termshare/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'termshare/cmd')
-rw-r--r--termshare/cmd/daemon.go25
-rw-r--r--termshare/cmd/root.go16
-rw-r--r--termshare/cmd/version.go24
3 files changed, 65 insertions, 0 deletions
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")
+ },
+}