Various Features for Discussion #330
Replies: 3 comments 3 replies
-
All great ideas. Private flagsSounds reasonable and easy to implement. Custom librariesWe will need to think about the discovery mechanism. I don't think the place for it is the Settings, since if you take the time to add them to the settings, you can just copy them instead - We probably need to come up with a convention, like Furthermore, it could be nice if there would be a Conditional privateAbout this one, I am not sure. This sounds like quite a niche functionality - I cannot recall any command line interface that changes its usage based on environment arguments. Let the command appear in the usage, and add a filter or some other blocking logic if somebody is running it where they should not. I am open to be convinced, but the implementation and accompanying documentation for such a feature must be simple and have a higher than minimal chance of being useful to more than 5% of users. For the first two, we can open a feature request issue to track separately. Do you want to do it or should I? |
Beta Was this translation helpful? Give feedback.
-
Yeah, well this is definitely easier and with more use cases. However, we distinguish between
Will this work for you? |
Beta Was this translation helpful? Give feedback.
-
All features implemented, except the Docker edge version was pushed, or if you want to test with the master branch, you also can. |
Beta Was this translation helpful? Give feedback.
-
Rather than opening direct feature requests, I thought I would start a discussion on some possible features that I’ve come across in trying to translate a large script I have into Bashly or have risen because of discussions on the other feature requests I have opened. I had a couple more ideas that would make it easier for users to hook into core Bashly functionality, but they’re not well formed and I don’t have a particular use case for them the way that I would these.
Private Flags
Right now, only (sub-)commands can be set to
private: true
and therefore hidden from documentation. This is useful, but occasionally I have flags on commands that I need to exist, but should not be used by default (either they are intended to be used by an internal re-invocation of the script or are options that are dangerous by default).Conditionally Private Commands / Flags
The script that I’m building is one that I eventually want to have in a Homebrew formula for or a MacPorts port. I want to have some commands (
cli self update
andcli self destruct
) that, if the script determines that it is running from a location not managed by the script itself (that is, it is running from/usr/local/bin
instead of$HOME/.local/bin
), those functions should be marked private and hidden fromcli --help
. I would obviously still need to have code in those core functions to treat them as invalid commands when they should be hidden, but this would be useful.The spec for this wouldn’t be too hard to change, as it would be similar to
command.default
: iftrue
orfalse
, it’s static. If astring
, it would be the name of a function which must be defined by the script author that could be called to test command or flag privacy at runtime.It appears that the completion script uses the
private
flag to determine what would be included. In this case, I would suggest thatprivate: String
is treated asprivate: false
.Custom
add
LibrariesI’m likely to be converting a half-dozen scripts to Bashly, and it would be nice to be able to do something like:
Sure, I can copy my existing library functions around, but it would be nice to have them in a repo for that purpose that extends Bashly’s
add
functionality. One key point: as Bashly is an opinionated tool, its defaults win. If I were to add acolors
library file, it would not add that, but the built-in Bashly library. It would have to be named differently, such asmy-colors
.Beta Was this translation helpful? Give feedback.
All reactions