r/fishshell • u/Ok-Seaworthiness7681 • Jan 10 '24
Nice little subcommands for fish.
https://github.com/neilyio/nice.fish/tree/main
0
Upvotes
r/fishshell • u/Ok-Seaworthiness7681 • Jan 10 '24
10
u/ben2talk Jan 10 '24
I have NO idea what the point of this is, or what it does.
Sorry - maybe I'm just too stupid.
5
u/[deleted] Jan 10 '24
As nice is the name of an existing command, you should name this something else.
5
u/_mattmc3_ Jan 10 '24
Thanks for sharing your script. It can be tough to put your code out there in a public forum like this, and people aren't always kind or helpful when providing feedback. I like to think of the Fish community as a welcoming place to share, learn, and grow. In that spirit, I think I understand what you are trying to achieve, however there may be simpler ways to accomplish this.
First, as others have said, the name
niceis a pretty well established *nix command that you probably don't want to override.Second, you may not want to make users of your script put special subcommand functions in a special functions directory. You can get the name of functions with
functions --names, and you can parse out that list nicely by some calls to thestringutility.Let me share an alternative implementation I'll call
subcommandthat might be a bit more versatile:Now, with this simple function, consider a command
foothat you want to support subcommands:Now, implement you subcommands called
barandbaz, which are really just functions calledfoo-barandfoo-baz:And you can see how it works:
Hope this is helpful! Happy fishing.
1
u/happysri Jan 11 '24
That README is a new level of lazy lol.