Skip to content

Commit b6c27cf

Browse files
committed
Display help when no command or argument is provided
1 parent cfc6750 commit b6c27cf

File tree

2 files changed

+44
-45
lines changed

2 files changed

+44
-45
lines changed

install.sh

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -49,66 +49,64 @@ elif [ "$(uname -s)" = "Linux" ]; then
4949
echo "ID: $ID"
5050
[ -n "$ID_LIKE" ] && echo "ID_LIKE: $ID_LIKE"
5151

52-
TEMP_DIR=$(mktemp -d)
53-
cd "$TEMP_DIR"
54-
52+
TEMP_DIR=/var/folders/dd/6w95nrsn6jn2qd5w439kzdzr0000gn/T/tmp.VwMa2wkGff
53+
cd ""
54+
5555
echo "Downloading binary..."
5656
curl -L -O "https://pepe.mhaimdat.com/0.2.7/x86_64-unknown-linux-gnu/pepe"
5757
curl -L -O "https://pepe.mhaimdat.com/0.2.7/x86_64-unknown-linux-gnu/pepe.sha256"
58-
58+
5959
echo "Verifying binary integrity..."
60-
EXPECTED_CHECKSUM=$(cat pepe.sha256)
61-
ACTUAL_CHECKSUM=$(sha256sum pepe | awk '{print $1}')
62-
63-
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
60+
EXPECTED_CHECKSUM=
61+
ACTUAL_CHECKSUM=
62+
63+
if [ "" != "" ]; then
6464
echo "Checksum verification failed!"
65-
echo "Expected: $EXPECTED_CHECKSUM"
66-
echo "Got: $ACTUAL_CHECKSUM"
65+
echo "Expected: "
66+
echo "Got: "
6767
cd -
68-
rm -rf "$TEMP_DIR"
68+
rm -rf ""
6969
exit 1
7070
fi
71-
71+
7272
echo -e "\033[1;32m✓ Checksum verified successfully.\033[0m"
7373
chmod +x pepe
7474

75-
# Create user binary directory if it doesn't exist
76-
USER_BIN_DIR="$HOME/.local/bin"
77-
mkdir -p "$USER_BIN_DIR"
78-
79-
# Add to PATH if not already there
80-
PROFILE_FILE="$HOME/.profile"
81-
if [ ! -f "$PROFILE_FILE" ] || ! grep -q "$USER_BIN_DIR" "$PROFILE_FILE"; then
82-
echo "export PATH=\"$USER_BIN_DIR:$PATH\"" >> "$PROFILE_FILE"
83-
echo "Added $USER_BIN_DIR to your PATH in $PROFILE_FILE"
84-
if has_sudo; then
85-
source $PROFILE_FILE
86-
else
87-
echo -e "\033[1;33m⚠️ Please run this command to update your PATH:\033[0m"
88-
echo -e "\033[1;32msource $PROFILE_FILE\033[0m"
75+
# Function to add PATH if missing
76+
add_to_path_if_missing() {
77+
local file=
78+
if [ -f "" ] && ! grep -q "" ""; then
79+
echo "export PATH=\":$PATH\"" >> ""
80+
echo "Added to "
8981
fi
90-
fi
82+
}
9183

92-
# Install the binary
93-
mv pepe "$USER_BIN_DIR/"
94-
echo -e "\033[1;32m✓ pepe has been installed to $USER_BIN_DIR/pepe\033[0m"
95-
96-
cd -
97-
rm -rf "$TEMP_DIR"
84+
# Check if sudo is available
85+
if command -v sudo >/dev/null 2>&1 && sudo -n true 2>/dev/null; then
86+
echo "Installing pepe to /usr/local/bin (requires sudo)..."
87+
sudo mv pepe /usr/local/bin/
88+
echo -e "\033[1;32m✓ pepe has been installed to /usr/local/bin/pepe\033[0m"
89+
else
90+
echo "Installing pepe to user space in /Users/omarmhaimdat/.local/bin/"
91+
USER_BIN_DIR="/Users/omarmhaimdat/.local/bin"
92+
mkdir -p ""
93+
mv pepe "/"
9894

99-
# Installation complete message with next steps
100-
printf "\033[1;32m✓ pepe installed successfully in user space!\033[0m\n"
101-
printf "\033[1;33m➜ To complete installation, run:\033[0m\n"
102-
printf "\033[1;32m source ~/.profile\033[0m\n\n"
103-
printf "\033[1;33m➜ Then verify with:\033[0m\n"
104-
printf "\033[1;32m pepe --help\033[0m\n"
105-
106-
# Check if pepe is in PATH
107-
if ! echo "/opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:/Users/omarmhaimdat/.opam/default/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/pyqt@5/5.15.4_1/bin:/opt/homebrew/opt/qt@5/bin:/opt/homebrew/opt/openjdk/bin:/Users/omarmhaimdat/Documents/cliTest/cliTests:/Users/omarmhaimdat/.opam/default/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/pyqt@5/5.15.4_1/bin:/opt/homebrew/opt/qt@5/bin:/opt/homebrew/opt/openjdk/bin:/Users/omarmhaimdat/Documents/cliTest/cliTests:/Users/omarmhaimdat/.cargo/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/omarmhaimdat/.fig/bin:/Users/omarmhaimdat/.local/bin:/Library/TeX/texbin:/usr/local/bin/musl-gcc:/Library/TeX/texbin:/usr/local/bin/musl-gcc:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/usr/local/bin:/Users/omarmhaimdat/go/bin" | grep -q ""; then
108-
printf "\033[1;31m! WARNING: is not in your PATH\033[0m\n"
109-
printf "\033[1;33m➜ Add this line to your shell config (~/.zshrc, ~/.bashrc):\033[0m\n"
110-
printf "\033[1;32m export PATH=\":$PATH\"\033[0m\n"
95+
# Update PATH in all relevant shell config files
96+
add_to_path_if_missing "/Users/omarmhaimdat/.profile"
97+
add_to_path_if_missing "/Users/omarmhaimdat/.bashrc"
98+
add_to_path_if_missing "/Users/omarmhaimdat/.bash_profile"
99+
add_to_path_if_missing "/Users/omarmhaimdat/.zshrc"
100+
101+
echo -e "\033[1;32m✓ pepe installed successfully in user space!\033[0m"
102+
echo -e "\033[1;33m➜ Restart your shell or run:\033[0m"
103+
echo -e "\033[1;32m source ~/.profile\033[0m"
104+
echo -e "\033[1;32m source ~/.bashrc # If using Bash\033[0m"
105+
echo -e "\033[1;32m source ~/.zshrc # If using Zsh\033[0m"
111106
fi
107+
108+
cd -
109+
rm -rf ""
112110
else
113111
echo -e "\033[1;31mUnsupported platform: $(uname)\033[0m"
114112
exit 1

src/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ impl Release {
3333
#[command(author = "Omar MHAIMDAT")]
3434
#[command(about = "HTTP load generator")]
3535
#[clap(disable_help_flag = true)]
36+
#[command(arg_required_else_help = true)]
3637
pub struct Cli {
3738
#[arg(short, long, action = HelpLong)]
3839
pub help: Option<bool>,

0 commit comments

Comments
 (0)