-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nushell support #1442
base: master
Are you sure you want to change the base?
Add nushell support #1442
Conversation
e8b3ccc
to
ed084cf
Compare
CC @scorphus Hopefully it's okay to ping you as I see you've made the last release :) |
Just tested it on my machine. Nice work! |
def get_aliases(self): | ||
aliases = {} | ||
command = 'help aliases | select name expansion | each { |row| $row.name + " ; " + $row.expansion } | str join (char nl)' | ||
proc = Popen(['nu', '-l', '-c', command], stdout=PIPE, stderr=DEVNULL) | ||
if proc.stdout is None: | ||
return aliases | ||
alias_out = proc.stdout.read().decode('utf-8').strip() | ||
for alias in alias_out.split('\n'): | ||
split_alias = alias.split(" ; ") | ||
if len(split_alias) == 2: | ||
name, value = split_alias | ||
aliases[name] = value | ||
return aliases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to get all the commands in nushell aswell using help commands
in here?
help aliases
only gets the actual aliases, i.e, stuff like alias vim = nvim
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, I'll change that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet, this will be awesome when its working merged!
Fixes #1441 #1254
The real issue wasn't the missing
Nushell
class, but rathersys.stdout.write
failing to makenushell
run the command.I've fixed that by running a
subprocess
, however it lacks access to any config/env that is set in the current session, it could be fixed by adding an-l
flag to the command, but that will also run anything that run on login (likeneofetch
).Still, also added a
Nushell
class with the relevant overrides.What do you think @nvbn ? Anything that could be changed let me know, it's my first time writing Python so I'm sure there are things that could be done better