-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1149 from rsteube/tmux-breakpane
tmux: break-pane
- Loading branch information
Showing
3 changed files
with
55 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/tmux" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var breakPaneCmd = &cobra.Command{ | ||
Use: "break-pane", | ||
Short: "break a pane from an existing into a new window", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(breakPaneCmd).Standalone() | ||
|
||
breakPaneCmd.Flags().StringS("F", "F", "", "specify output format") | ||
breakPaneCmd.Flags().BoolS("P", "P", false, "print information of new window after it has been created") | ||
breakPaneCmd.Flags().BoolS("a", "a", false, "move window to next index after") | ||
breakPaneCmd.Flags().BoolS("b", "b", false, "move window to next index before") | ||
breakPaneCmd.Flags().BoolS("d", "d", false, "don't make the new window become the active one") | ||
breakPaneCmd.Flags().StringS("n", "n", "", "specify window name") | ||
breakPaneCmd.Flags().StringS("s", "s", "", "specify source pane") | ||
breakPaneCmd.Flags().StringS("t", "t", "", "specify destination window") | ||
rootCmd.AddCommand(breakPaneCmd) | ||
|
||
// TODO output format | ||
carapace.Gen(breakPaneCmd).FlagCompletion(carapace.ActionMap{ | ||
"s": tmux.ActionPanes(), | ||
"t": tmux.ActionWindows(), | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package tmux | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/rsteube/carapace" | ||
) | ||
|
||
// ActionPanes completes panes | ||
func ActionPanes() carapace.Action { | ||
return carapace.ActionExecCommand("tmux", "list-panes")(func(output []byte) carapace.Action { | ||
lines := strings.Split(string(output), "\n") | ||
|
||
vals := make([]string, 0) | ||
for _, line := range lines { | ||
if splitted := strings.SplitN(line, ": ", 2); len(splitted) == 2 { | ||
vals = append(vals, splitted...) | ||
} | ||
} | ||
return carapace.ActionValuesDescribed(vals...) | ||
}) | ||
} |