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

list aliases and custom commands in current scope #2821

Open
fdncred opened this issue Dec 25, 2020 · 9 comments
Open

list aliases and custom commands in current scope #2821

fdncred opened this issue Dec 25, 2020 · 9 comments
Assignees

Comments

@fdncred
Copy link
Collaborator

@fdncred fdncred commented Dec 25, 2020

Is your feature request related to a problem? Please describe.
yes, when i source a script file, i'd like to be able to tell if it really sourced. i ran into a problem where i was sourcing a file but it really wasn't getting sourced because i was in the wrong directory.

Describe the solution you'd like
maybe something like scope_show --aliases and scope_show --commands and scope_show --custom_commands or maybe just an augmentation to the help commands functionality like help commands --aliases or help commands --custom. i'm not real picky but it will output a table with columns like "row number, name, description, type (alias or custom command), alias/cmd text"

@sousajf1
Copy link
Contributor

@sousajf1 sousajf1 commented Jan 1, 2021

hello. would like to work on this one!

@fdncred
Copy link
Collaborator Author

@fdncred fdncred commented Jan 1, 2021

it's yours @sousajf1. Thanks and good luck! :)

@sousajf1
Copy link
Contributor

@sousajf1 sousajf1 commented Jan 7, 2021

@jonathandturner hello. me and @fdncred we were talking about this issue, and it seems that we indeed need to get the current scope. Question is how can we do that? How can we differentiate the current scope from the global one.
What do you think?

@fdncred
Copy link
Collaborator Author

@fdncred fdncred commented Jan 7, 2021

@sousajf1 while waiting on JT to respond you might want to take a look at which_.rs since that code figures out whether a given string is an internal command, alias, or custom command. There's an interesting function there that may be helpful.

fn entry_for(scope: &Scope, name: &str, tag: Tag) -> Option<Value> {
    if scope.has_custom_command(name) {
        Some(create_entry!(name, "Nushell custom command", tag, false))
    } else if scope.has_command(name) {
        Some(create_entry!(name, "Nushell built-in command", tag, true))
    } else if scope.has_alias(name) {
        Some(create_entry!(name, "Nushell alias", tag, false))
    } else {
        None
    }
}
@sousajf1
Copy link
Contributor

@sousajf1 sousajf1 commented Jan 8, 2021

I'll try to take a look into it this weekend :) ty

@KwakGiyoung
Copy link

@KwakGiyoung KwakGiyoung commented Jan 9, 2021

같이 합시다

@fdncred
Copy link
Collaborator Author

@fdncred fdncred commented Jan 19, 2021

@sousajf1 What's the status on this? @KwakGiyoung is offering to help. I don't speak Korean but that's what google translate says. :)

@sousajf1
Copy link
Contributor

@sousajf1 sousajf1 commented Jan 19, 2021

Sorry I've been away for a bit, moving from my old apartment. @KwakGiyoung we can work on it together sure :) . maybe we can chat on discord?

@fdncred
Copy link
Collaborator Author

@fdncred fdncred commented Jan 19, 2021

@sousajf1 no worries at all. just checking in. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants