mirror of
https://github.com/nushell/nu_scripts.git
synced 2024-09-11 13:45:56 +03: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
@ -81,6 +81,23 @@ def "nu-complete sessions" [] {
|
||||
^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
|
||||
#export extern "zellij" [
|
||||
# command?: string@"nu-complete zellij"
|
||||
@ -106,6 +123,15 @@ export extern "zellij action rename-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
|
||||
export extern "zellij attach" [
|
||||
session_name: string@"nu-complete sessions" # Name of the session to attach to
|
||||
|
Loading…
Reference in New Issue
Block a user