Skip to content
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

Print Aliases #9011

Closed
Ktoks opened this issue Apr 26, 2023 · 6 comments
Closed

Print Aliases #9011

Ktoks opened this issue Apr 26, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@Ktoks
Copy link

Ktoks commented Apr 26, 2023

Related problem

The problem is not being able to print off and view my aliases - this is a feature bash provides.
Simply by inputting in alias - bash outputs all aliases for the current environment/session.

Describe the solution you'd like

I would like to have similar output to alias from bash, but perhaps like nu's ls command- it could separate the output into 2 columns split column by =. This would be an upgrade on the bash alias functionality - and could greatly improve productivity for those who repeatedly use complicated commands.

Describe alternatives you've considered

I've considered writing my own nu function, but discarded the idea because - currently that would not work in my environment as an aliased command or script.

Additional context and details

I'm unable to run nu scripts that call other scripts or functions because I don't have root access on said environment. Administrators and governance are currently deliberating over installing it.

@Ktoks Ktoks added the enhancement New feature or request label Apr 26, 2023
@pingiun
Copy link
Contributor

pingiun commented Apr 26, 2023

try $nu.scope.aliases

@Ktoks
Copy link
Author

Ktoks commented Apr 26, 2023

That's great, kind of long, but it does have all the functionality I was looking for. How hard would it be to implement an empty alias call to output the same?

@fdncred
Copy link
Collaborator

fdncred commented Apr 26, 2023

How about help aliases?

@Ktoks
Copy link
Author

Ktoks commented Apr 26, 2023

I can remember that.
Thank you.
Sorry, I should have brought this up on Discord.

@Ktoks Ktoks closed this as completed Apr 26, 2023
@conqp
Copy link

conqp commented Aug 15, 2023

try $nu.scope.aliases

This is still in the docs but does not seem to work with nu 0.83.1:

/root > pacman -Q nushell                                                                         08/15/2023 09:30:41 PM
nushell 0.83.1-1
/root > $nu.scope.aliases                                                                         08/15/2023 09:30:43 PM
Error: nu::shell::column_not_found

  × Cannot find column
   ╭─[entry #4:1:1]
 1 │ $nu.scope.aliases
   · ─┬─ ──┬──
   ·  │    ╰── cannot find column 'scope'
   ·  ╰── value originates here
   ╰────

/root >                          

Otoh, help aliases works like a charm.
It should be added to the docs.

@fdncred
Copy link
Collaborator

fdncred commented Aug 15, 2023

ya, i'm sure the docs are out of date. we move the $nu.scope stuff to a scope family of commands.

❯ help scope
Commands for getting info about what is in scope.

Usage:
  > scope

Subcommands:
  scope aliases - Output info on the aliases in the current scope.
  scope commands - Output info on the commands in the current scope.
  scope engine-stats - Output stats on the engine in the current state.
  scope modules - Output info on the modules in the current scope.
  scope variables - Output info on the variables in the current scope.

Flags:
  -h, --help - Display the help message for this command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants