@ -34,10 +34,14 @@ var listCmd = &cobra.Command{
|
||||
Short: "A brief description of your command",
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := tmux.ListProjects()
|
||||
projects, err := tmux.ListProjects()
|
||||
if err != nil {
|
||||
fmt.Println("Unable to list projects:", err)
|
||||
}
|
||||
|
||||
for _, project := range projects {
|
||||
fmt.Println(project)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,14 @@ 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)
|
||||
projects, err := tmux.ListActiveProjects()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
for _, project := range projects {
|
||||
fmt.Println(project)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ var rootCmd = &cobra.Command{
|
||||
Long: "",
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) < 1 {
|
||||
return errors.New("No project or command given")
|
||||
return errors.New("no project or command given")
|
||||
}
|
||||
startCmd.Run(cmd, args)
|
||||
return nil
|
||||
@ -54,7 +54,7 @@ var rootCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func completeProjects(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
projects, err := tmux.ProjectList()
|
||||
projects, err := tmux.ListProjects()
|
||||
if err != nil {
|
||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
@ -36,8 +36,7 @@ var stopCmd = &cobra.Command{
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var projects []string
|
||||
if len(args) == 0 {
|
||||
t := tmux.Tmux{}
|
||||
projects = t.ListSessions()
|
||||
projects, _ = tmux.ListActiveProjects()
|
||||
} else {
|
||||
projects = args
|
||||
}
|
||||
|
Reference in New Issue
Block a user