2022-09-15 07:50:35 +02:00
|
|
|
From a4f0fd0560c39d58472ef09e4228948e88012d33 Mon Sep 17 00:00:00 2001
|
2022-07-28 13:35:04 +02:00
|
|
|
From: Dario Faggioli <dfaggioli@suse.com>
|
|
|
|
Date: Thu, 28 Jul 2022 10:10:28 +0200
|
2022-09-15 07:50:35 +02:00
|
|
|
Subject: [PATCH] distrobox: if no command is specified, default to enter
|
2022-07-28 13:35:04 +02:00
|
|
|
|
|
|
|
If just `distrobox` is invoked, without any command, assume
|
|
|
|
`distrobox enter`.
|
|
|
|
|
|
|
|
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
|
|
|
|
---
|
2022-09-15 07:50:35 +02:00
|
|
|
distrobox | 18 ++++++++++++------
|
2022-07-28 13:35:04 +02:00
|
|
|
docs/README.md | 1 +
|
2022-09-15 07:50:35 +02:00
|
|
|
2 files changed, 13 insertions(+), 6 deletions(-)
|
2022-07-28 13:35:04 +02:00
|
|
|
|
|
|
|
diff --git a/distrobox b/distrobox
|
2022-09-15 07:50:35 +02:00
|
|
|
index 0f83b54..9b53547 100755
|
2022-07-28 13:35:04 +02:00
|
|
|
--- a/distrobox
|
|
|
|
+++ b/distrobox
|
2022-09-15 07:50:35 +02:00
|
|
|
@@ -19,6 +19,12 @@
|
2022-07-28 13:35:04 +02:00
|
|
|
# along with distrobox; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# POSIX
|
|
|
|
+# Optional env variables:
|
|
|
|
+# DBX_DEFAULT_COMMAND
|
|
|
|
+
|
|
|
|
+default_command="enter"
|
|
|
|
+[ -n "${DBX_DEFAULT_COMMAND}" ] && default_command="${DBX_DEFAULT_COMMAND}"
|
2022-09-15 07:50:35 +02:00
|
|
|
+
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
2022-07-28 13:35:04 +02:00
|
|
|
|
2022-09-15 07:50:35 +02:00
|
|
|
@@ -48,15 +54,15 @@ Choose one of the available commands:
|
2022-07-28 13:35:04 +02:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2022-09-15 07:50:35 +02:00
|
|
|
+distrobox_path="$(dirname "${0}")"
|
|
|
|
if [ $# -eq 0 ]; then
|
2022-07-28 13:35:04 +02:00
|
|
|
- show_help
|
|
|
|
- exit
|
|
|
|
+ printf "No command specified. Assuming: distrobox-%s\n" "${default_command}"
|
|
|
|
+ distrobox_command="${default_command}"
|
|
|
|
+else
|
|
|
|
+ distrobox_command="${1}"
|
|
|
|
+ shift
|
2022-09-15 07:50:35 +02:00
|
|
|
fi
|
2022-07-28 13:35:04 +02:00
|
|
|
|
2022-09-15 07:50:35 +02:00
|
|
|
-distrobox_path="$(dirname "${0}")"
|
|
|
|
-distrobox_command="${1}"
|
|
|
|
-shift
|
|
|
|
-
|
2022-07-28 13:35:04 +02:00
|
|
|
# Simple wrapper to the distrobox utilities.
|
|
|
|
# We just detect the 1st argument and launch the matching distrobox utility.
|
2022-09-15 07:50:35 +02:00
|
|
|
case "${distrobox_command}" in
|
2022-07-28 13:35:04 +02:00
|
|
|
diff --git a/docs/README.md b/docs/README.md
|
2022-09-15 07:50:35 +02:00
|
|
|
index 8ec20bf..165985f 100644
|
2022-07-28 13:35:04 +02:00
|
|
|
--- a/docs/README.md
|
|
|
|
+++ b/docs/README.md
|
2022-09-15 07:50:35 +02:00
|
|
|
@@ -283,6 +283,7 @@ Alternatively it is possible to specify preferences using ENV variables:
|
2022-07-28 13:35:04 +02:00
|
|
|
- DBX_CONTAINER_NAME
|
|
|
|
- DBX_NON_INTERACTIVE
|
|
|
|
- DBX_SKIP_WORKDIR
|
|
|
|
+- DBX_DEFAULT_COMMAND
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
--
|
2022-09-15 07:50:35 +02:00
|
|
|
2.37.3
|
2022-07-28 13:35:04 +02:00
|
|
|
|