mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
Add compatibility note about Nu version (#1057)
This is my response for #1051 The syntax of this note is inspired by Rust _Cargo.toml_ and Python _pyproject.toml_.
This commit is contained in:
parent
1e7fdd4427
commit
1da73cf106
2 changed files with 11 additions and 6 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
# nu-version: 0.102.0
|
||||||
|
|
||||||
module git-completion-utils {
|
module git-completion-utils {
|
||||||
export const GIT_SKIPABLE_FLAGS = ['-v', '--version', '-h', '--help', '-p', '--paginate', '-P', '--no-pager', '--no-replace-objects', '--bare']
|
export const GIT_SKIPABLE_FLAGS = ['-v', '--version', '-h', '--help', '-p', '--paginate', '-P', '--no-pager', '--no-replace-objects', '--bare']
|
||||||
|
|
||||||
|
@ -106,8 +108,8 @@ module git-completion-utils {
|
||||||
let floating_remotes = $lines | filter { "\t" not-in $in and $in not-in $tracked_remotes }
|
let floating_remotes = $lines | filter { "\t" not-in $in and $in not-in $tracked_remotes }
|
||||||
$floating_remotes | each {
|
$floating_remotes | each {
|
||||||
let v = $in | split row -n 2 '/' | get 1
|
let v = $in | split row -n 2 '/' | get 1
|
||||||
if $v != $current { [$v] } else []
|
if $v == $current { null } else $v
|
||||||
} | flatten
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export def extract-mergable-sources [current: string]: list<string> -> list<record<value: string, description: string>> {
|
export def extract-mergable-sources [current: string]: list<string> -> list<record<value: string, description: string>> {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# nu-version: 0.102.0
|
||||||
|
|
||||||
export extern "ssh" [
|
export extern "ssh" [
|
||||||
destination?: string@"nu-complete ssh-host"
|
destination?: string@"nu-complete ssh-host"
|
||||||
-4 # Forces ssh to use IPv4 addresses only.
|
-4 # Forces ssh to use IPv4 addresses only.
|
||||||
|
@ -41,11 +43,12 @@ module ssh-completion-utils {
|
||||||
# │ 4 │ │
|
# │ 4 │ │
|
||||||
# ╰───┴──────────────────────────────╯
|
# ╰───┴──────────────────────────────╯
|
||||||
let host = $in
|
let host = $in
|
||||||
let name = $host | get 0 | str trim | split row -r '\s+' | get 1
|
let $first_line = try { $host | first | str trim } catch { null }
|
||||||
# Don't accept blocks like "Host *"
|
# Don't accept blocks like "Host *"
|
||||||
if ('*' in $name) {
|
if ($first_line | is-empty) or '*' in $first_line {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
|
let name = $first_line | split row -r '\s+' | get 1
|
||||||
# May not contain hostname
|
# May not contain hostname
|
||||||
match ($host | slice 1.. | find -ir '^\s*Hostname\s') {
|
match ($host | slice 1.. | find -ir '^\s*Hostname\s') {
|
||||||
[] => null,
|
[] => null,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue