Coder Social home page Coder Social logo

nu_scripts's People

Contributors

amtoine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nu_scripts's Issues

add a `tomb` module

I would like to add a module, e.g. called tomb, mainly a tomb manage function, to easily interact with tombs ๐Ÿ’€

use default values for unset environment variables

until now, all the scripts assume the environment variables they use are set, either in env.nu or in the current interactive shell with a manual let-env VAR = val.

however, this is error prone when used on another config than man which sets all the variables, 'cause i use them

i want to use default values to make sure all the environment variables are set at runtime ๐Ÿ‘

an example

  • let vm_directory = ($env.QUICKEMU_HOME | path join $os) in vm.nu#L54 would become
let vm_directory = (
  $env | get -i QUICKEMU_HOME | default "~/.local/share/quickemu" | path expand
  | path join $os
)
  • let path = ($env.GHQ_ROOT | path join $repo) in repo.nu#L100 would become
let path = (
  $env | get -i GHQ_ROOT | default "~/.local/share/ghq" | path expand
  | path join $repo
)

add the documentation

from amtoine/dotfiles#32

there are a lot of TODOs in the nushell modules...
namely i left the documentation undone intentionnally until... well now ๐Ÿ‘€

i would like to complete all the documentation of the nushell modules and get rid of all the TODOs ๐Ÿ‘

use clean `return` instead of `error make`ing

that is a proposition, e.g. instead of having

Error:
  ร— User choose to exit...
    โ•ญโ”€[scripts/prompt.nu:27:1]
 27 โ”‚     if ($choice | is-empty) {
 28 โ”‚         error make (context user_choose_to_exit)
    ยท         โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
    ยท              โ•ฐโ”€โ”€ User choose to exit...
 29 โ”‚     }
    โ•ฐโ”€โ”€โ”€โ”€

when pressing <C-c> inside the selection of repo goto we could have a simpler

User choose to exit...

`spwd` does not work outside `$HOME`

when i cd to /tmp/, even /tmp/foo/, i get

Error: nu::shell::eval_block_with_input (link)

  ร— Eval block failed with pipeline input
    โ•ญโ”€[scripts/shell_prompt.nu:12:1]
 12 โ”‚     $"!/($env.PWD)" |
 13 โ”‚       str replace $"!/($home)" ~ -s |
    ยท       โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€
    ยท            โ•ฐโ”€โ”€ source value
 14 โ”‚       split row $sep
    โ•ฐโ”€โ”€โ”€โ”€

Error: nu::shell::access_beyond_end (link)

  ร— Row number too large (empty content).
    โ•ญโ”€[scripts/shell_prompt.nu:24:1]
 24 โ”‚       $el
 25 โ”‚     } else if ($spwd_src.0 == ".") {
    ยท                          โ”ฌ
    ยท                          โ•ฐโ”€โ”€ index too large (empty content)
 26 โ”‚       $".($spwd_src.1)"
    โ•ฐโ”€โ”€โ”€โ”€

plugin.nu isn't cross platform

We discussed this here nushell/nushell#8583 (comment). Excerpt below.

https://github.com/goatfiles/nu_scripts/blob/bleeding/scripts/plugin.nu

@amtoine I noticed that this script isn't cross platform. It doesn't really matter for you, but if someone on Windows wants to use this, they need to change this line:

| str replace '^register (.*) \s+{' '{"binary": "$1",'

to something more like this

| str replace '^register (.*) \s+{' `{"binary": '$1',`

notice the difference is "$1" vs '$1'. Double quotes means to interpret escapes, which is fine for *nix, but on Windows where paths are like C:\some\path, all that mess is now escaped because of double quotes.

refactor the source files to make them easier to read and work with

i would like to refactor the scripts a bit, mainly

  • fix some indentation and typos
  • use the | pipe symbol at the beginning of the lines instead of the end
    this is both
    • easier to read because one can see the pipe directly when starting a line
    • easier to work with because all the lines of a pipe, except the first obviously, have the same structure and can thus be removed or shuffles without breaking the pipeline

for instance, to change

start-of-pipe |
command-1 |
command-2 |
end-of-pipe

one would have to make sure the | is added to the last command and removed from others when shuffling

with

start-of-pipe
| command-1
| command-2
| end-of-pipe

one can shuffle and remove any of the last three commands without ever breaking the pipeline itself ๐Ÿ‘

add a `trash` module

I would like to add a module, e.g. called trash, to interact with the freedesktop trash functionnality activated by the $env.config.rm.always_trash option.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.