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

feat: alias management commands (#25) #159

Merged
merged 6 commits into from
Feb 21, 2023
Merged

feat: alias management commands (#25) #159

merged 6 commits into from
Feb 21, 2023

Conversation

roele
Copy link
Contributor

@roele roele commented Feb 21, 2023

This is a draft on the alias management commands.

Couple of caveats

  • not sure if 2-3 arguments should be used rather than the proposed dot notation "<PLUGIN>.<ALIAS>" (or even "<PLUGIN@ALIAS>"?)
  • ls command uses option -p to specify a plugin but since this is for filtering this might not be an inconsistency
  • adding an alias adds an empty [alias] section in the config.toml
  • found a discrepancy with aliases (singular/plural) in rtxrc.rs

src/cli/alias/get.rs Outdated Show resolved Hide resolved
src/cli/alias/mod.rs Show resolved Hide resolved
#[clap(visible_aliases = ["add", "create"], after_long_help = AFTER_LONG_HELP.as_str(), verbatim_doc_comment)]
pub struct AliasSet {
/// The plugin to set the alias for
pub plugin: String,
Copy link
Owner

@jdx jdx Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these shouldn't use pub (unless I'm missing something)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was wondering about this as well but it seems other commands also define those as public

@jdx
Copy link
Owner

jdx commented Feb 21, 2023

not sure if 2-3 arguments should be used rather than the proposed dot notation "." (or even "PLUGIN@ALIAS"?)

I think I like multiple arguments the most. For runtimes I've settled on using plugin@version but that's so we can use multiple, e.g.: rtx i nodejs@10 nodejs@12. That seems less useful here.

ls command uses option -p to specify a plugin but since this is for filtering this might not be an inconsistency

This is because it's a root command. It has to use an option because if you ran rtx alias get it wouldn't be possible to know if "get" was the name of a plugin or the name of a subcommand.

adding an alias adds an empty [alias] section in the config.toml

worth noting but I think we can live with this

found a discrepancy with aliases (singular/plural) in rtxrc.rs

yep, good catch

@codecov
Copy link

codecov bot commented Feb 21, 2023

Codecov Report

Base: 81.77% // Head: 82.14% // Increases project coverage by +0.37% 🎉

Coverage data is based on head (ae06e76) compared to base (934271e).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head ae06e76 differs from pull request most recent head d71d2d8. Consider uploading reports for the commit d71d2d8 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
+ Coverage   81.77%   82.14%   +0.37%     
==========================================
  Files          86       89       +3     
  Lines        2809     2845      +36     
==========================================
+ Hits         2297     2337      +40     
+ Misses        512      508       -4     
Impacted Files Coverage Δ
src/cli/alias/get.rs 100.00% <100.00%> (ø)
src/cli/alias/mod.rs 100.00% <100.00%> (ø)
src/cli/alias/set.rs 100.00% <100.00%> (ø)
src/cli/alias/unset.rs 100.00% <100.00%> (ø)
src/config/config_file/rtxrc.rs 79.02% <100.00%> (+1.42%) ⬆️
src/cli/self_update.rs 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

- regenerate help and completions
@roele roele marked this pull request as ready for review February 21, 2023 01:35
src/config/config_file/rtxrc.rs Outdated Show resolved Hide resolved

/// Show an alias for a plugin
///
/// This is the contents of an alias.<PLUGIN> entry in ~/.config/rtx/config.toml
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably out of scope, but I wonder if we could generate this path using env::CONFIG_FILE_PATH or whatever that is.

Don't worry about this one unless you're particularly curious.

@jdx
Copy link
Owner

jdx commented Feb 21, 2023

I'll go ahead and merge this once the tests pass

@jdx jdx enabled auto-merge (squash) February 21, 2023 03:06
@jdx jdx merged commit fcb74d7 into jdx:main Feb 21, 2023
@jdx
Copy link
Owner

jdx commented Feb 21, 2023

thanks again for the help!

@jdx jdx linked an issue Feb 21, 2023 that may be closed by this pull request
@roele roele deleted the issues/25 branch February 22, 2023 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

alias management commands
2 participants