refactor: rename b conf to bcon
This commit is contained in:
6
b.sh
6
b.sh
@@ -48,7 +48,7 @@ _b_completion() {
|
||||
|
||||
# If completing the first argument after 'b'
|
||||
if [ "$COMP_CWORD" -eq 1 ]; then
|
||||
opts="all conf bye"
|
||||
opts="all con bye"
|
||||
|
||||
local routes_file="$HOME/.config/bootstrap/routes.sh"
|
||||
if [ -f "$routes_file" ]; then
|
||||
@@ -82,8 +82,8 @@ _b_completion() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
# If completing arguments for 'b conf <config_dir>'
|
||||
if [ "$COMP_CWORD" -eq 2 ] && [ "$prev" = "conf" ]; then
|
||||
# If completing arguments for 'b con <config_dir>'
|
||||
if [ "$COMP_CWORD" -eq 2 ] && [ "$prev" = "con" ]; then
|
||||
# List of directories in ~/.config/ to choose from
|
||||
local config_dirs
|
||||
config_dirs=$(find "$HOME/.config" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; 2>/dev/null)
|
||||
|
||||
@@ -72,7 +72,7 @@ install_bootstrap() {
|
||||
"lib/platform.sh"
|
||||
"lib/shell_config.sh"
|
||||
"commands/help.sh"
|
||||
"commands/conf.sh"
|
||||
"commands/con.sh"
|
||||
"commands/uninstall.sh"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Command: conf
|
||||
# Command: con
|
||||
# Edits configurations in ~/.config/
|
||||
|
||||
config_name="${1:-}"
|
||||
if [ -z "$config_name" ]; then
|
||||
log_error "Usage: b conf <config_name> [files...]"
|
||||
log_error "Usage: b con <config_name> [files...]"
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
@@ -4,7 +4,7 @@
|
||||
echo "Available bootstrap commands:"
|
||||
# Non-installers first (aligned to 6 chars width)
|
||||
printf " %-6s - %s\n" "all" "List all available commands"
|
||||
printf " %-6s - %s\n" "conf" "Edit config (e.g. b conf nvim)"
|
||||
printf " %-6s - %s\n" "con" "Edit config (e.g. b con nvim)"
|
||||
printf " %-6s - %s\n" "bye" "Uninstall Bootstrap CLI helper"
|
||||
|
||||
# Installers second
|
||||
|
||||
@@ -36,8 +36,8 @@ b nvim,yazi
|
||||
You can also edit configurations located in your `~/.config/` directory by running:
|
||||
|
||||
```bash
|
||||
b conf nvim
|
||||
b conf i3
|
||||
b con nvim
|
||||
b con i3
|
||||
```
|
||||
|
||||
It automatically fuzzy-finds the folder in case there is no exact match.
|
||||
|
||||
@@ -71,9 +71,9 @@ for script in "${SCRIPTS[@]}"; do
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
conf)
|
||||
if [ -f "$BOOTSTRAP_DIR/commands/conf.sh" ]; then
|
||||
. "$BOOTSTRAP_DIR/commands/conf.sh" "$@"
|
||||
con)
|
||||
if [ -f "$BOOTSTRAP_DIR/commands/con.sh" ]; then
|
||||
. "$BOOTSTRAP_DIR/commands/con.sh" "$@"
|
||||
else
|
||||
log_error "Config editor command script not found."
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user