mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
Add zellij action new-tab
completions (#821)
This PR add completions for this `zellij action new-tab` command, which is currently missing.
This commit is contained in:
parent
1a4c6e9a6c
commit
b95f260bb4
1 changed files with 26 additions and 0 deletions
|
@ -81,6 +81,23 @@ def "nu-complete sessions" [] {
|
||||||
^zellij ls -n | lines | parse "{value} {description}"
|
^zellij ls -n | lines | parse "{value} {description}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def "nu-complete zellij layouts" [] {
|
||||||
|
let layout_dir = if 'ZELLIJ_CONFIG_DIR' in $env {
|
||||||
|
[$env.ZELLIJ_CONFIG_DIR "layouts"] | path join
|
||||||
|
} else {
|
||||||
|
match $nu.os-info.name {
|
||||||
|
"linux" => "~/.config/zellij/layouts/"
|
||||||
|
"mac" => "~/Library/Application Support/org.Zellij-Contributors.Zellij/layouts"
|
||||||
|
_ => (error make { msg: "Unsupported OS for zellij" })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ls ( $layout_dir | path expand )
|
||||||
|
| where name =~ "\\.kdl"
|
||||||
|
| get name
|
||||||
|
| each { |$it| { value: ($it | path basename | str replace ".kdl" ""), description: $it } }
|
||||||
|
}
|
||||||
|
|
||||||
# Turned off since it messes with sub-commands
|
# Turned off since it messes with sub-commands
|
||||||
#export extern "zellij" [
|
#export extern "zellij" [
|
||||||
# command?: string@"nu-complete zellij"
|
# command?: string@"nu-complete zellij"
|
||||||
|
@ -106,6 +123,15 @@ export extern "zellij action rename-tab" [
|
||||||
name: string # Name for the tab
|
name: string # Name for the tab
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Create a new tab, optionally with a specified tab layout and name
|
||||||
|
export extern "zellij action new-tab" [
|
||||||
|
--cwd(-c): path # Change the working directory of the new tab
|
||||||
|
--help(-h) # Print help information
|
||||||
|
--layout(-l): string@"nu-complete zellij layouts" # Layout ot use for the new tab
|
||||||
|
--layout-dir: path # Default folder to look for layouts
|
||||||
|
--name(-n): string # Name for the tab
|
||||||
|
]
|
||||||
|
|
||||||
# Attach to a session
|
# Attach to a session
|
||||||
export extern "zellij attach" [
|
export extern "zellij attach" [
|
||||||
session_name: string@"nu-complete sessions" # Name of the session to attach to
|
session_name: string@"nu-complete sessions" # Name of the session to attach to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue