44 questions
0
votes
0
answers
66
views
nushell polars plugin panicking
I just created this function for making label-encoding:
# Custom command to perform label encoding on a specified column of a table, it returns a polar dataframe
@example "Simple example" {
...
1
vote
1
answer
168
views
How to properly set up Ruby gem environment to use ruby-lsp for Helix?
I have some troubles that prevent me from using ruby-lsp with helix 25.01.1.
I use Voidlinux and nushell 0.104.0 and have built from source ruby 3.5.0dev via the official repository.
Here is my gem ...
0
votes
1
answer
561
views
How to execute Nushell commands inside nvim command line?
I am using Neovim in Windows 11 26100.3476, with msys2 for gcc to run Zsh.
I used to use this Zsh command in Neovim:
# this is my config in ~/.zshrc
function ngr(){
cd /c/SoftWare/Nginx && ./...
2
votes
1
answer
650
views
How to convert Record to Table in Nushell?
I found how to convert Table to Record using the following code
here.
let fruits_original = [[key, value]; [apple 10] [banana 42] [mango 5]]
let fruits = $fruits_original | reduce -f {} {|it, acc| $...
0
votes
2
answers
92
views
Optimizations in branching if statements
I'm writing custom execution time formatter function for Nushell, and came across the need to display values when they are needed. First, take a look at the code:
def tooktime_fmt [exect: string] {
...
0
votes
1
answer
412
views
How to add multiple entries in a alias in Nu Shell?
I was wondering if there is any way to have something like:
alias system = sudo vpm sync; sudo vpm update; sudo vpm autoremove; sudo vpm cleanup
This is possible in bash and fish.
I was not able to ...
1
vote
2
answers
1k
views
How can I extract multiple fields in nushell?
I have a Nushell command:
cat airports.yaml | from yaml | sort-by "latitude_deg" | reverse | get 'latitude_deg,name' | first 20 | to json
How can I output both the name and latitude_deg ...
4
votes
1
answer
268
views
Git under nushell not using added ssh-key
I am having trouble setting up nushell in windows 11 to not always ask me for the password for my ssh-key when I am using git.
I have confirmed that ssh-agent is running used ssh-add to add my key and
...
4
votes
2
answers
3k
views
Set environment variables from file of key/value pairs in Nu
As in this question for Bash, I'd like to have a simple .env file or similar that I can read into the Nushell environment. While I'll typically use this for API keys, to simply re-use the same ...
2
votes
1
answer
1k
views
In Nushell, how can I compare two lists and find the items not in common?
I have two reasonably-sized lists of (real-example) Stack Overflow answer IDs that I'm checking for suspected ChatGPT usage. One set is a list of answer IDs I captured a few days ago, and the other ...
3
votes
2
answers
837
views
How can I get the current timestamp minus 30 minutes in nushell?
I searched for a replacement of date -d in Nushell but I didn't find anything.
How can I get the current datetime minus N minutes ? Like this $((date now) - 30 minutes)
3
votes
2
answers
648
views
How to "open" a mysql table from nushell?
I'd like to have tables from a mysql table as dataframes in nushell, but currently nushell only accepts sqlite. Is there a workaround for this?
1
vote
1
answer
95
views
Clang can't find .o files when linking in nushell compilation script
I am currently trying to write a build script for a c++ project in Nushell.
It's a fairly simple setup, with a library that is built first and then and exe that is build in an other script and linked ...
1
vote
1
answer
765
views
how to redirect stderr to a file in NuShell?
Here is what I tried
ls | to json | save fileList.json
open fileList.json | from json | save error.log
open fileList.json | from json | save --stderr error.log
It didn't save anything to file error....
2
votes
1
answer
1k
views
Colored text to the console
How can I echo colored text to the console?
In Powershell I can do this:
write-host _info_ -fore Yellow -Back Blue
write-host _error_ -fore Yellow -Back Red
write-host _warning_ -fore White -...
0
votes
1
answer
293
views
Why does using a variable as a function parameter cause a type mismatch error in a later function call?
def make-list [val?: string] {
["f1" "f2"]
}
def use-list [list: list] {
$list | each { |it| $it + "!" }
}
let $val = "abc"
let $l = (make-list $val)
...
3
votes
1
answer
994
views
Create new column base upon existing column in Nushell
I am new to Nushell and would like to create a quick way to locate my files by their "tags", which are in the filename. This is the method used by tagspaces. For instance, using the ls ...
6
votes
1
answer
2k
views
How do I check if a directory exists in a Nushell script?
I would like to know how I check if a directory exists in Nushell?
2
votes
1
answer
1k
views
expand collapsed data in nushell
I'm trying to learn nushell, and from this example in the documentation,
> echo [[column1, column2]; [Value1, Value2]]
───┬─────────┬─────────
# │ column1 │ column2
───┼─────────┼─────────
0 │ ...
3
votes
1
answer
2k
views
while/until loops in Nushell
Author's note: This question uses outdated syntax and statements from an older version of Nushell. Please see the answer(s) below for the updated syntax.
How do you do while/until loops in Nushell ...
7
votes
2
answers
3k
views
how to run powershell command from nushell
After installing nushell (https://www.nushell.sh/) in my windows environment, I want to use the power of nushell in conjunction with powershell.
For example, I need to invoke common powershell ...
9
votes
4
answers
2k
views
Get current script location in Nushell
In Bash, you can use the $0 variable to get the location of the current script. How I do the same in Nu? echo $nu doesn't seem to have anything I can use.