8000 Add `status dirname` and `status basename` convenience commands by faho · Pull Request #7076 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

Add status dirname and status basename convenience commands#7076

Merged
faho merged 1 commit intofish-shell:masterfrom
faho:status-dirname
Jun 4, 2020
Merged

Add status dirname and status basename convenience commands#7076
faho merged 1 commit intofish-shell:masterfrom
faho:status-dirname

Conversation

@faho
Copy link
Member
@faho faho commented Jun 2, 2020

Description

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)

And while we're at it, add "status basename" as well.

There are some alternatives here, including:

  • Making dirname a builtin - this doesn't solve the problem of having that boilerplate and it has the problems associated with overriding system commands

  • Adding 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 issue

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

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)
@faho faho added this to the fish 3.2.0 milestone Jun 2, 2020
@krobelus
Copy link
Contributor
krobelus commented Jun 2, 2020

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.

@faho
Copy link
Member Author
faho commented Jun 2, 2020

Surprisingly I found just one occurrence (I must be doing something wrong here).

Yeah, that can't be right.

One problem is that status filename is available under... too many names, tbh. One of them is status -f, and that finds me a bunch of results, including

@ridiculousfish
Copy link
Member

Changes LGTM. I don't have any objection to status dirname or status basename if this pattern is used often.

@faho faho merged commit 44184f6 into fish-shell:master Jun 4, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2020
@faho faho deleted the status-dirname branch September 23, 2021 09:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0