-
Notifications
You must be signed in to change notification settings - Fork 6
main: move 'jump' and 'visit' to subcommands #72
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
Conversation
This fixes #70. Prior to this change, there was a mix of subcommands and flags that were all mutually-exclusive behaviors. This ended up being a bit awkward and made some configurations ambiguous. This moves to a much nicer structure. There are global flags (right now just debug), and then there are subcommands for each distinct mode of operation. For ease of migration, the previous logic still remains, but it can be safely deleted after another release or so to allow migration.
This also updates the help output test for the previous commit's changes.
Prior to this it was just 'pazi' which did so, but it's more useful in the long run to have 'pazi' by itself print help. This provides a migration path to that. This also fixes a regression that would have occured if all the deprecated code were deleted.
After this is merged:
|
This allows properly using it in the 'match' expression.
@@ -90,13 +136,18 @@ fn _main() -> PaziResult { | |||
.long("interactive") | |||
.short("i"), | |||
) | |||
// Deprecated in favor of .PaziSubcommand::Visit | |||
// left temporarily for backwards compatibility | |||
// Remove before 1.0 | |||
.arg( | |||
Arg::with_name("add-dir") |
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.
Should this be hidden as well?
.arg( | ||
Arg::with_name("add-dir") | ||
.help("add a directory to the frecency index") | ||
.long("add-dir") | ||
.takes_value(true) | ||
.value_name("directory"), | ||
) | ||
// Deprecated per above deprecations |
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.
Ditto here for dir_target
src/main.rs
Outdated
Some(to) => { | ||
env::current_dir() | ||
.map(|cwd| { | ||
frecency.maybe_add_relative_to(cwd, to); |
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.
Do we want this behavior here? It makes sense for jump
(to help jumpstart (heh) a small database) but for view
I'm not so sure.
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.
I was just keeping the behavior it had previously since this is a refactor more than anything else.
Now that the code is split out properly, it does make sense to drop that here I think.
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.
Actually, it doens't do save_to_disk
in this function (nor did it before) so that's entirely dead code. Good catch.
It didn't actually save the change before, so this is behaviorally identical, just deletes some pointless code.
This fixes #70.
Prior to this change, there was a mix of subcommands and flags that were
all mutually-exclusive behaviours.
This ended up being a bit awkward and made some configurations
ambiguous.
This moves to a much nicer structure. There are global flags (right now
just debug), and then there are subcommands for each distinct
mode of operation.
For ease of migration, the previous logic still remains, but it can be
safely deleted after another release or so to allow migration.