From 90d2ed73009ca03359857982d0617e5decca0249 Mon Sep 17 00:00:00 2001 From: James Walker Date: Thu, 2 Dec 2021 22:32:38 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20ps=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/ps.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cmd/ps.go diff --git a/cmd/ps.go b/cmd/ps.go new file mode 100644 index 0000000..3da5da3 --- /dev/null +++ b/cmd/ps.go @@ -0,0 +1,46 @@ +/* +Copyright © 2021 James Walker + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" + "github.com/walkah/workon/tmux" +) + +// psCmd represents the ps command +var psCmd = &cobra.Command{ + Use: "ps", + Short: "List currently running projects.", + Run: func(cmd *cobra.Command, args []string) { + t := tmux.Tmux{} + for _, project := range t.ListSessions() { + fmt.Println(project) + } + + }, +} + +func init() { + rootCmd.AddCommand(psCmd) +}