Add status dirname and status basename convenience commands#7076
Merged
faho merged 1 commit intofish-shell:masterfrom Jun 4, 2020
Merged
Add status dirname and status basename convenience commands#7076faho merged 1 commit intofish-shell:masterfrom
status dirname and status basename convenience commands#7076faho merged 1 commit intofish-shell:masterfrom
Conversation
There's a terrible number of fishscripts that start with
set path (dirname (status filename))
And that's really just a bit boring.
So let's let it be
set path (status dirname)
Contributor
|
Surprisingly I found just one occurrence (I must be doing something wrong here). Of course this pattern is super common in (ba)sh scripts so we want have a good story here, even though if it doesn't matter much for interactive use. |
Member
Author
Yeah, that can't be right. One problem is that |
Member
|
Changes LGTM. I don't have any objection to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
There's a terrible number of fishscripts that start with
And that's really just a bit boring.
So let's let it be
And while we're at it, add "status basename" as well.
There are some alternatives here, including:
Making
dirnamea builtin - this doesn't solve the problem of having that boilerplate and it has the problems associated with overriding system commandsAdding a variable - tbh I'm not super fond of adding more electric variables unless necessary
Adding an option to
status filename-status filename --dir-only- this is a bit uglier, it does cut down on the number of subcommands, but I don't think that's much of an issueTODOs: