Split existing `botstrap init` CLI command into two separate commands
nuztalgia opened this issue · 0 comments
Summary
The botstrap
CLI should provide two distinct commands for creating a new bot project - botstrap init
and botstrap new
.
Problem
The behavior of botstrap init
is opaque - it tries to be "smart" when determining whether the user wants to create a new bot project in the current working directory or a new subdirectory thereof. This often ends up being more confusing than convenient. Explicitly putting the choice in the user's hands (by splitting the existing command into two separate ones) will improve both clarity and control.
Current Solution
The current implementation of botstrap init
roughly boils down to the following logic:
-
If the name of the bot is the same as the name of the current working directory, ask the user if they want to create the bot project in the current working directory. Otherwise, ask them if they want to create it in a subdirectory (named after the bot) of the current working directory.
-
If the user responds non-affirmatively, ask them about the opposite option from the above bullet point.
-
If the user responds non-affirmatively again, allow them to enter a custom directory name (i.e. relative path from the current working directory to the directory in which to create a new bot project).
This behavior was intended to provide convenience and control, but its counterintuitiveness ended up undermining that goal.
Ideal Solution
The bot-name-and-directory-selection behavior should be explicitly dictated by the command that the user chooses to use:
-
botstrap init [options]
- Create a Discord bot project in the current directory. -
botstrap new [options] path
- Create a Discord bot project in the given directory. (Note: Thepath
argument is required. It replaces the existing positional argument,name
.)
Both commands should allow the bot name to be specified by setting the --name
or -n
option. If unspecified, the bot name should default to a slugified version of the directory name.
Alternatives
-
See the "Current Solution" section above.
-
Another idea is to provide only one of the commands listed in the "Ideal Solution" section. Doing so would likely improve simplicity/clarity, while (slightly) reducing convenience/control. This may be worth considering in the future if/when the number of
botstrap
CLI commands grows enough for there to be significant value in pruning similar commands.
Additional Context
The model described in the "Ideal Solution" section is based on the init
and new
commands from Cargo, the package manager for Rust. It also generally describes much more common CLI behavior than that of the current botstrap init
implementation, and should therefore be more in-line with users' expectations.