mirror of
https://github.com/nushell/nu_scripts.git
synced 2024-08-16 08:50:31 +03:00
🐛 fix more parser errors (#783)
Hi! I reduced some of the errors in the daily CI. Still there are a few of them, but at least is something - Added the badge for the `daily.yml` (currently failing) - removed old `docker` from v0.60 - removed old `git` from auto-generate completions - removed `nethack` from auto-generate completions (wasn't very useful) - removed `root` from auto-generate completions (wasn't very useful) - removed `valgrind` from auto-generate completions (wasn't very useful) - moved `less` from auto-generate to custom-completions. - moved `mix` from auto-generate to custom-completions. - moved `tar` from auto-generate to custom-completions. - moved `tcpdump` from auto-generate to custom-completions. - moved `virsh` from auto-generate to custom-completions. - moved `zef` from auto-generate to custom-completions. - fixed `base16.nu` - fixed `from-cpuinfo.nu` - fixed `from-dmicode.nu` - fixed `to-number-format.nu` - fixed `to-json-schema.nu`
This commit is contained in:
parent
878bfc615c
commit
13a73ab635
@ -1,5 +1,8 @@
|
||||
# Nushell Scripts
|
||||
|
||||
![CI](https://github.com/nushell/nu_scripts/actions/workflows/daily.yml/badge.svg)
|
||||
|
||||
|
||||
This is a place to share Nushell scripts with each other. If you'd like to share your scripts, fork this repository, and [create a PR](https://github.com/nushell/nu_scripts/compare) that adds it to the repo.
|
||||
|
||||
## Sections
|
||||
|
@ -1,16 +0,0 @@
|
||||
### Docker
|
||||
|
||||
This directory contains few simple scripts to simplify docker workflow in nushell
|
||||
|
||||
### Deployment
|
||||
|
||||
source the scripts in startup section of your `config.toml` file
|
||||
|
||||
### Usage
|
||||
* docker.nu - Wrapper around regular docker command, returns a formatted nushell table
|
||||
* compose.nu - Finds compose files of all running containers and then stops them via `docker-compose down`
|
||||
|
||||
### Notes
|
||||
* Both commands assume the user is a mamber of `docker` group, if that is not the case prepend the commands with `sudo`
|
||||
|
||||
* docker.nu should be sourced before compose.nu in your `config.toml` file as the latter uses the former
|
@ -1,14 +0,0 @@
|
||||
# stops all running containers via their compose files
|
||||
def compose [] {
|
||||
docker ps|
|
||||
each {
|
||||
docker inspect $it.ID|
|
||||
get Config.Labels|
|
||||
select 'com.docker.compose.project.working_dir' 'com.docker.compose.project.config_files'|
|
||||
rename dir file
|
||||
}|
|
||||
uniq|
|
||||
each {
|
||||
docker-compose -f (build-string $it.dir '/' $it.file) down
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
# docker wrapper that returns a nushell table
|
||||
def docker [
|
||||
...args:string # command to be passed to the real docker command
|
||||
] {
|
||||
let data = (^docker $args --format={{json .}}|lines|each {$it|from json})
|
||||
if Labels in ($data|get) {
|
||||
$data|docker labels
|
||||
} {
|
||||
$data
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# subcommand used to reformat docker labels into their own table
|
||||
def 'docker labels' [] {
|
||||
update Labels {
|
||||
get Labels|
|
||||
split row ','|
|
||||
where ($it|str starts-with ' ') == $false|
|
||||
split column '=' name value
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
# Specify a playground directory
|
||||
extern "nethack" [
|
||||
--version # Show version information
|
||||
--version:paste # Show version information & copy it to paste buffer
|
||||
...args
|
||||
]
|
@ -1,5 +0,0 @@
|
||||
# Run in batch mode
|
||||
extern "root" [
|
||||
--help(-\?) # Print help
|
||||
...args
|
||||
]
|
@ -1,51 +0,0 @@
|
||||
[# Skin
|
||||
extern "" [
|
||||
|
||||
...args
|
||||
]
|
||||
# Valgrind-ise children
|
||||
extern " yes no" [
|
||||
|
||||
...args
|
||||
]
|
||||
# Log to file descriptor
|
||||
extern " 0 1 2 3 4 5 6 7 8 9" [
|
||||
|
||||
...args
|
||||
]
|
||||
# Check for memory leaks
|
||||
extern " no\tDont\ check\ for\ memory\ leaks summary\t'Show a leak summary' full\t'Describe memory leaks in detail'" [
|
||||
|
||||
...args
|
||||
]
|
||||
# Show reachable leaked memory
|
||||
extern " yes\t'Show reachable leaked memory' no\t'Do not show reachable leaked memory'" [
|
||||
|
||||
...args
|
||||
]
|
||||
# Determines how willingly Memcheck considers different backtraces to be the same
|
||||
extern " low\t'Two entries need to match' med\t'Four entries need to match' high\t'All entries need to match'" [
|
||||
|
||||
...args
|
||||
]
|
||||
# How to handle loads of words that are partially addressible
|
||||
extern " yes\t"Do not emit errors on partial loads" no\t"Emit errors on partial loads" [
|
||||
|
||||
...args
|
||||
]
|
||||
# Check for memory leaks
|
||||
extern " no\t'Do not check for memory leaks' summary\t'Show a leak summary' full\t'Describe memory leaks in detail'" [
|
||||
|
||||
...args
|
||||
]]
|
||||
|
||||
[# Display help and exit
|
||||
extern "valgrind" [
|
||||
|
||||
...args
|
||||
]
|
||||
#
|
||||
extern "valgrind yes no" [
|
||||
|
||||
...args
|
||||
]]
|
@ -1,6 +1,6 @@
|
||||
# Display help and exit
|
||||
extern "less" [
|
||||
--help(-\?) # Display help and exit
|
||||
--help(-?) # Display help and exit
|
||||
--search-skip-screen(-a) # Search after end of screen
|
||||
--auto-buffers(-B) # Disable automtic buffer allocation
|
||||
--clear-screen(-c) # Repaint from top
|
||||
@ -35,14 +35,16 @@ extern "less" [
|
||||
--HILITE-UNREAD(-W) # Highlight first unread line on any movement
|
||||
--no-init(-X) # No termcap init
|
||||
--no-keypad # No keypad init
|
||||
--tilde(-\~) # Lines after EOF are blank
|
||||
--shift(-\#) # Characters to scroll on left/right arrows
|
||||
--tilde(-~) # Lines after EOF are blank
|
||||
--shift # Characters to scroll on left/right arrows
|
||||
# this breaks the parser
|
||||
# --shift(-#) # Characters to scroll on left/right arrows
|
||||
...args
|
||||
]
|
||||
|
||||
# Characters to scroll on left/right arrows
|
||||
extern "less 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" [
|
||||
--help(-\?) # Display help and exit
|
||||
--help(-?) # Display help and exit
|
||||
--search-skip-screen(-a) # Search after end of screen
|
||||
--auto-buffers(-B) # Disable automtic buffer allocation
|
||||
--clear-screen(-c) # Repaint from top
|
||||
@ -77,7 +79,7 @@ extern "less 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" [
|
||||
--HILITE-UNREAD(-W) # Highlight first unread line on any movement
|
||||
--no-init(-X) # No termcap init
|
||||
--no-keypad # No keypad init
|
||||
--tilde(-\~) # Lines after EOF are blank
|
||||
--shift(-\#) # Characters to scroll on left/right arrows
|
||||
--tilde(-~) # Lines after EOF are blank
|
||||
# --shift(-#) # Characters to scroll on left/right arrows
|
||||
...args
|
||||
]
|
@ -148,12 +148,13 @@ extern "mix profile.fprof" [
|
||||
|
||||
# Runs the given file or expression
|
||||
extern "mix run" [
|
||||
--config(-c) # loads the given configuration file
|
||||
--config(-c) # loads the given configuration file
|
||||
--eval(-e) # evaluates the given code
|
||||
--require(-r) # requires pattern before running the command
|
||||
--parallel-require(-pr) # requires pattern in parallel
|
||||
--no-compile # does not compile even if files require compilation
|
||||
--no-deps-check # does not check dependencies
|
||||
--require(-r) # requires pattern before running the command
|
||||
--parallel-require # requires pattern in parallel
|
||||
--pr # requires pattern in parallel
|
||||
--no-compile # does not compile even if files require compilation
|
||||
--no-deps-check # does not check dependencies
|
||||
--no-halt # does not halt the system after running the command
|
||||
--no-start # does not start applications after compilation
|
||||
...args
|
@ -8,7 +8,7 @@ extern "tar" [
|
||||
--list(-t) # List archive
|
||||
--update(-u) # Append new files
|
||||
--get(-x) # Extract from archive
|
||||
--help(-\?) # Display short option summary
|
||||
--help(-?) # Display short option summary
|
||||
--usage # List available options
|
||||
--atime-preserve # Keep access time
|
||||
--block-size(-b) # Block size
|
@ -8,7 +8,9 @@ extern "tcpdump" [
|
||||
--list-time-stamp-types(-J) # List the supported time stamp types for the interface
|
||||
--dont-verify-checksums(-K) # Dont attempt to verify IP, TCP, or UDP checksums
|
||||
--list-data-link-types(-L) # List the known data link types for the interface
|
||||
--number(-\#) # Print an optional packet number
|
||||
--number # Print an optional packet number
|
||||
# breaks the parser
|
||||
# --number(-\#) # Print an optional packet number
|
||||
--no-optimize(-O) # Do not run the packet-matching code optimizer
|
||||
--no-promiscuous-mode(-p) # Dont put the interface into promiscuous mode
|
||||
--absolute-tcp-sequence-numbers(-S) # Print absolute TCP sequence numbers
|
@ -4,12 +4,6 @@ extern "virsh" [
|
||||
...args
|
||||
]
|
||||
|
||||
# Show version
|
||||
extern "virsh short\tShort\ version long\tLong\ version" [
|
||||
|
||||
...args
|
||||
]
|
||||
|
||||
# Attach device from an XML file
|
||||
extern "virsh attach-device" [
|
||||
--persistent # Make live change persistent
|
@ -6,17 +6,18 @@ extern "zef" [
|
||||
|
||||
# Install specific distributions by name or path
|
||||
extern "zef install" [
|
||||
# all the --/ commands break the parser
|
||||
--fetch
|
||||
--build
|
||||
--/build # Skip the building phase
|
||||
#--/build # Skip the building phase
|
||||
--test
|
||||
--/test # Skip the testing phase
|
||||
#--/test # Skip the testing phase
|
||||
--depends
|
||||
--/depends # Do not fetch runtime dependencies
|
||||
#--/depends # Do not fetch runtime dependencies
|
||||
--build-depends
|
||||
--/build-depends # Do not fetch build dependencies
|
||||
#--/build-depends # Do not fetch build dependencies
|
||||
--test-depends
|
||||
--/test-depends # Do not fetch test dependencies
|
||||
#--/test-depends # Do not fetch test dependencies
|
||||
--force # Ignore errors
|
||||
--force-resolve # Ignore errors
|
||||
--force-fetch # Ignore errors
|
||||
@ -27,7 +28,7 @@ extern "zef install" [
|
||||
--dry # Run all phases except the actual installations
|
||||
--serial # Install each dependency after passing testing and before building/testing the next dependency
|
||||
--update # Force a refresh for all module indexes or a specific ecosystem
|
||||
--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
#--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
--exclude
|
||||
--to # Short name or spec of CompUnit::Repository to install to
|
||||
--install-to # Short name or spec of CompUnit::Repository to install to
|
||||
@ -58,7 +59,7 @@ extern "zef fetch" [
|
||||
--force # Ignore errors
|
||||
--force-fetch # Ignore errors
|
||||
--update # Force a refresh for all module indexes or a specific ecosystem
|
||||
--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
#--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
...args
|
||||
]
|
||||
|
||||
@ -79,15 +80,15 @@ extern "zef update" [
|
||||
extern "zef upgrade" [
|
||||
--fetch
|
||||
--build
|
||||
--/build # Skip the building phase
|
||||
#--/build # Skip the building phase
|
||||
--test
|
||||
--/test # Skip the testing phase
|
||||
#--/test # Skip the testing phase
|
||||
--depends
|
||||
--/depends # Do not fetch runtime dependencies
|
||||
#--/depends # Do not fetch runtime dependencies
|
||||
--build-depends
|
||||
--/build-depends # Do not fetch build dependencies
|
||||
#--/build-depends # Do not fetch build dependencies
|
||||
--test-depends
|
||||
--/test-depends # Do not fetch test dependencies
|
||||
#--/test-depends # Do not fetch test dependencies
|
||||
--force # Ignore errors
|
||||
--force-resolve # Ignore errors
|
||||
--force-fetch # Ignore errors
|
||||
@ -98,7 +99,7 @@ extern "zef upgrade" [
|
||||
--dry # Run all phases except the actual installations
|
||||
--serial # Install each dependency after passing testing and before building/testing the next dependency
|
||||
--update # Force a refresh for all module indexes or a specific ecosystem
|
||||
--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
#--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
--exclude
|
||||
--to # Short name or spec of CompUnit::Repository to install to
|
||||
--install-to # Short name or spec of CompUnit::Repository to install to
|
||||
@ -108,28 +109,28 @@ extern "zef upgrade" [
|
||||
# Show a list of possible distribution candidates for the given terms
|
||||
extern "zef search" [
|
||||
--update # Force a refresh for all module indexes or a specific ecosystem
|
||||
--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
#--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
...args
|
||||
]
|
||||
|
||||
# Show detailed distribution information
|
||||
extern "zef info" [
|
||||
--update # Force a refresh for all module indexes or a specific ecosystem
|
||||
--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
#--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
...args
|
||||
]
|
||||
|
||||
# Browse support urls (bugtracker etc)
|
||||
extern "zef browse" [
|
||||
--open
|
||||
--/open
|
||||
#--/open
|
||||
...args
|
||||
]
|
||||
|
||||
# List available distributions
|
||||
extern "zef list" [
|
||||
--update # Force a refresh for all module indexes or a specific ecosystem
|
||||
--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
#--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
--installed(-i)
|
||||
...args
|
||||
]
|
||||
@ -137,22 +138,22 @@ extern "zef list" [
|
||||
# List full dependencies for a given identity
|
||||
extern "zef depends" [
|
||||
--depends
|
||||
--/depends # Do not fetch runtime dependencies
|
||||
#--/depends # Do not fetch runtime dependencies
|
||||
--build-depends
|
||||
--/build-depends # Do not fetch build dependencies
|
||||
#--/build-depends # Do not fetch build dependencies
|
||||
--test-depends
|
||||
--/test-depends # Do not fetch test dependencies
|
||||
#--/test-depends # Do not fetch test dependencies
|
||||
...args
|
||||
]
|
||||
|
||||
# List all distributions directly depending on a given identity
|
||||
extern "zef rdepends" [
|
||||
--depends
|
||||
--/depends # Do not fetch runtime dependencies
|
||||
#--/depends # Do not fetch runtime dependencies
|
||||
--build-depends
|
||||
--/build-depends # Do not fetch build dependencies
|
||||
#--/build-depends # Do not fetch build dependencies
|
||||
--test-depends
|
||||
--/test-depends # Do not fetch test dependencies
|
||||
#--/test-depends # Do not fetch test dependencies
|
||||
...args
|
||||
]
|
||||
|
||||
@ -167,15 +168,15 @@ extern "zef locate" [
|
||||
extern "zef smoke" [
|
||||
--fetch
|
||||
--build
|
||||
--/build # Skip the building phase
|
||||
#--/build # Skip the building phase
|
||||
--test
|
||||
--/test # Skip the testing phase
|
||||
#--/test # Skip the testing phase
|
||||
--depends
|
||||
--/depends # Do not fetch runtime dependencies
|
||||
#--/depends # Do not fetch runtime dependencies
|
||||
--build-depends
|
||||
--/build-depends # Do not fetch build dependencies
|
||||
#--/build-depends # Do not fetch build dependencies
|
||||
--test-depends
|
||||
--/test-depends # Do not fetch test dependencies
|
||||
#--/test-depends # Do not fetch test dependencies
|
||||
--force # Ignore errors
|
||||
--force-resolve # Ignore errors
|
||||
--force-fetch # Ignore errors
|
||||
@ -186,7 +187,7 @@ extern "zef smoke" [
|
||||
--dry # Run all phases except the actual installations
|
||||
--serial # Install each dependency after passing testing and before building/testing the next dependency
|
||||
--update # Force a refresh for all module indexes or a specific ecosystem
|
||||
--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
#--/update # Skip refreshing all module indexes or a specific ecosystem
|
||||
--exclude
|
||||
--to # Short name or spec of CompUnit::Repository to install to
|
||||
--install-to # Short name or spec of CompUnit::Repository to install to
|
@ -142,7 +142,7 @@ export def from-file-table [base_txt: path] {
|
||||
|
||||
# Replace {{baseXX-hex}} with proper colors, such as #ffeedd
|
||||
def apply-base16-mustache [template: string] {
|
||||
reduce -f $template {
|
||||
reduce -f $template { |it|
|
||||
let subs = $"\{\{($it.item.name)-hex\}\}" # regex
|
||||
let color = $it.item.color
|
||||
$it.acc | str replace -a $subs $color
|
||||
|
@ -7,7 +7,7 @@ export def "from cpuinfo" [] {
|
||||
| str trim
|
||||
| update column1 {
|
||||
get column1
|
||||
| str replace -a -s ' ' '_'
|
||||
| str replace -a ' ' '_'
|
||||
}
|
||||
| transpose -r -d
|
||||
| update flags {
|
||||
|
@ -22,7 +22,7 @@ export def "from dmidecode" [] {
|
||||
| split column ':'
|
||||
| str trim
|
||||
| str downcase column1
|
||||
| str replace -a -s ' ' '_' column1
|
||||
| str replace -a ' ' '_' column1
|
||||
| transpose -r -d
|
||||
}
|
||||
} else {
|
||||
|
@ -16,7 +16,7 @@ export def number-format [
|
||||
$parts.0
|
||||
| split chars
|
||||
| reverse
|
||||
| reduce -n -f [] {
|
||||
| reduce -f [] {
|
||||
|it, acc| if ((($it.index + 1) mod 3) == 0) {
|
||||
$acc.item
|
||||
| append $it.item
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Converts specific JSON to JSON schema.
|
||||
def to-json-schema [schema: int, url: string, json: string] {
|
||||
if not $schema in [4, 7] {
|
||||
if ($schema != 4 or $schema != 7) {
|
||||
error make { msg: $"'http://json-schema.org/draft-0($schema)/schema' is not supported yet." }
|
||||
}
|
||||
if url == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user