• Stars
    star
    597
  • Rank 74,979 (Top 2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A CLI tool to get help with CLI tools 🐙

A CLI tool to get help with CLI tools 🐙

GitHub Release Crate Release Coverage
Continuous Integration Continuous Deployment Docker Builds Documentation

halp demo

halp aims to help find the correct arguments for command-line tools by checking the predefined list of commonly used options/flags. Additionally, it provides a prompt for quick access to the manual page or cheat sheet of the given command.

If you deal with command-line tools often, it might take some time to figure out how to get help or check the version of a particular command (especially when shell completions are not available). In that case, you might try the most-known flags such as -h and -v but unfortunately not all the command-line tools follow these conventions (either due to conflicts with other flags or they just use another form). Instead of brute-forcing manually into getting help, you can run halp <command> and it will check the following arguments for you:

  • for help: -h, --help, help, -H
  • for version info: -v, -V, --version, version

If one of these arguments succeeds (with exit code 0), it prints the output and exits. This way, you can get informed about the version and help in one single command. You can also customize this list with a configuration file or provide a list of arguments via command-line arguments.

On the other hand, if you really need help, you can use the plz subcommand which will prompt a selection for:

  1. show the man page (runs man(1))
  2. show the cheat sheet (via cheat.sh)
Table of Contents

Example

Have you ever experienced this:

$ cli_tool -v
unknown flag -v
$ cli_tool -V
unknown flag -V
$ cli_tool -h
unknown flag -h
$ asdjw1jwhdajh1idojad # frustration
bash: asdjw1jwhdajh1idojad: command not found
$ cli_tool --help # f*cking finally!
Some CLI Tool Version 1.42.69
Usage:
  cli_tool <flags> <args> [--parameter1 value1 --parameter2 value2 ...]

Whereas with halp:

$ halp cli_tool

(°ロ°)  checking 'cli_tool -v'
(×﹏×)      fail '-v' argument not found.
(°ロ°)  checking 'cli_tool -V'
(×﹏×)      fail '-V' argument not found.
(°ロ°)  checking 'cli_tool -h'
(×﹏×)      fail '-h' argument not found.
(°ロ°)  checking 'cli_tool --help'
\(^ヮ^)/ success '--help' argument found!

Some CLI Tool Version 1.42.69
Usage:
  cli_tool <flags> <args> [--parameter1 value1 --parameter2 value2 ...]

Installation

Packaging status

Packaging status

Cargo

halp can be installed from crates.io:

cargo install halp

The minimum supported Rust version is 1.64.0.

Arch Linux

halp can be installed from the community repository using pacman:

pacman -S halp

Or you can install the available AUR packages using an AUR helper. For example,

paru -S halp-git

Alternatively, you can clone the AUR package and then build it with makepkg. For example,

git clone https://aur.archlinux.org/halp-git.git && cd halp-git && makepkg -si

Docker

Images

Docker builds are automated and images are available in the following registries:

Usage

The following commands can be used to get help for a binary inside the container:

docker run --rm -it "orhunp/halp:${TAG:-latest}" whoami
docker run --rm -it "orhunp/halp:${TAG:-latest}" plz whoami

Or you can provide a custom binary as follows (please note that you might get shared library errors):

docker run -v "bin:/app/bin:rw" --rm -it "orhunp/halp:${TAG:-latest}" -v ./bin

Building

Custom Docker images can be built from the Dockerfile:

docker build -t halp .

Binary releases

See the available binaries for different targets from the releases page. They are automated via Continuous Deployment workflow

Release tarballs are signed with the following PGP key: 0xFB41AE0358378256

Build from source

  1. Clone the repository.
git clone https://github.com/orhun/halp && cd halp/
  1. Build.
CARGO_TARGET_DIR=target cargo build --release

Binary will be located at target/release/halp.

Usage

halp [OPTIONS] <CMD>
Options:
      --check <ARG>    Sets the argument to check
      --no-version     Disable checking the version information
      --no-help        Disable checking the help information
  -c, --config <PATH>  Sets the configuration file [env: HALP_CONFIG=]
  -v, --verbose        Enables verbose logging
  -h, --help           Print help
  -V, --version        Print version

plz

halp [OPTIONS] plz <CMD>
Options:
  -m, --man-cmd <MAN_CMD>   Sets the manual page command to run [default: man]
      --cheat-sh-url <URL>  Use a custom URL for cheat.sh [env: CHEAT_SH_URL=]
  -p, --pager <PAGER>       Sets the pager to use [default: "less -R"]
      --no-pager            Disables the pager
  -h, --help                Print help

Examples

Check help and version (default)

halp whoami

halp example I

Check a custom argument

halp --check "\--silent" zps

(You can escape - with using \-.)

You can also provide multiple arguments as follows:

halp --check "help" --check "test" menyoki

Disable defaults

halp --no-version sha512sum
halp --no-help sha512sum

Verbose logging

halp --verbose git-cliff

This will result in stderr/stdout being printed if there was an error. For example:

(°ロ°)  checking 'git-cliff -v'
(×﹏×)      fail '-v' argument not found.
(o_O)      debug
stdout:
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
 ERROR git_cliff > Git error: `could not find repository from '.'; class=Repository (6); code=NotFound (-3)`

Get additional help (via plz)

halp plz vim

halp example II

Custom pager
halp plz --pager bat vim

To disable the pager:

halp plz --no-pager bat vim
Custom cheat.sh host URL
halp plz --cheat-sh-url https://cht.sh vim

Configuration

halp can be configured with a configuration file that uses the TOML format. It can be specified via --config or HALP_CONFIG environment variable. It can also be placed in one of the following global locations:

  • <config_dir> / halp.toml
  • <config_dir> / halp/halp.toml
  • <config_dir> / halp/config

<config_dir> depends on the platform as shown in the following table:

Platform Value Example
Linux $XDG_CONFIG_HOME or $HOME/.config /home/orhun/.config
macOS $HOME/Library/Application Support /Users/Orhun/Library/Application Support
Windows {FOLDERID_RoamingAppData} C:\Users\Orhun\AppData\Roaming

See halp.toml for the default configuration values.

Funding

If you find halp and/or other projects on my GitHub profile useful, consider supporting me on GitHub Sponsors or becoming a patron!

Support me on GitHub Sponsors Support me on Patreon Support me on Patreon

Contributing

See our Contribution Guide and please follow the Code of Conduct in all your interactions with the project.

License

Licensed under either of Apache License Version 2.0 or The MIT License at your option.

🦀 ノ( º _ º ノ) - respect crables!

Copyright

Copyright © 2023, Orhun Parmaksız

More Repositories

1

git-cliff

A highly customizable Changelog Generator that follows Conventional Commit specifications ⛰️
Rust
5,800
star
2

kmon

Linux Kernel Manager and Activity Monitor 🐧💻
Rust
1,911
star
3

systeroid

A more powerful alternative to sysctl(8) with a terminal user interface 🐧
Rust
997
star
4

gpg-tui

Manage your GnuPG keys with ease! 🔐
Rust
991
star
5

rustypaste

A minimal file upload/pastebin service.
Rust
757
star
6

menyoki

Screen{shot,cast} and perform ImageOps on the command line 🌱 🏞️
Rust
489
star
7

linuxwave

Generate music from the entropy of Linux 🐧🎵
Zig
399
star
8

pkgtop

Interactive package manager and resource monitor designed for the GNU/Linux.
Go
268
star
9

runst

A dead simple notification daemon 🦡
Rust
234
star
10

zps

A small utility for listing and reaping zombie processes on GNU/Linux.
C
153
star
11

CoolModFiles

A web player that plays some cool MOD files randomly 🎶
JavaScript
132
star
12

kermit

A VTE-based, simple and froggy terminal emulator 🐸
C
114
star
13

rust-tui-template

A template for bootstrapping a Rust TUI application with tui-rs & crossterm
Rust
77
star
14

dotfiles

Orhun's Arch Linux configuration files and scripts 🏠
Shell
70
star
15

godsays

Rust port of the Terry Davis' (RIP) "god says" program
Rust
69
star
16

rtl_map

FFT-based visualizer for RTL-SDR devices. (RTL2832/DVB-T)
C
67
star
17

battleship-rs

Battleship game implemented in Rust
Rust
65
star
18

git-cliff-action

GitHub action to generate a changelog based on the Git history
Shell
65
star
19

rustypaste-cli

A CLI tool for rustypaste
Rust
56
star
20

k3pler

Android network connection blocker and packet analyzer built on top of local HTTP proxy.
Java
48
star
21

orhun

My GitHub profile README.md ⭐:octocat:
41
star
22

ApkServInject

Tool for injecting (smali) services to APK files
Java
30
star
23

cargo-nocode

Cargo subcommand to easily bootstrap nocode applications. Write nothing; deploy nowhere.
Rust
29
star
24

god

Linux utility for simplifying the Git usage.
Go
25
star
25

dnsleaktest-tui

A proof-of-concept TUI for testing DNS leaks & running traceroute
Rust
20
star
26

PSAUX

Android task manager and automated background service killer.
Java
20
star
27

alpkg

Set up Alpine Linux packaging environment with a breeze! 🏔
Shell
18
star
28

packaging-rust-for-npm

https://blog.orhun.dev/packaging-rust-for-npm/
JavaScript
17
star
29

Picasso

PIC16F877A based 5V/20MHz development board and PIC programmer
C
15
star
30

PKGBUILDs

Arch Linux packages that I maintain 🔧
Shell
13
star
31

personal-blog

The source of my blog ✍🏼
SCSS
13
star
32

dialogflowbot

Google's Dialogflow implementation on Android with additional features.
Java
11
star
33

i3-workspace-brightness

Utility to auto-adjust the brightness of i3wm workspaces
Rust
11
star
34

Black-Waves

A wavy dark theme for VSCode
10
star
35

HydropotX

Automated and Self-contained Hydroponics System 🌱
Kotlin
9
star
36

advent-of-code

My Advent of Code solutions 🐢
Rust
8
star
37

Last-Commit

A VSCode extension that focuses on the last git commit
JavaScript
7
star
38

zig-http-benchmarks

Benchmarking Zig HTTP client against Rust, Go, Python and curl
Zig
6
star
39

binsider

Analyze ELF binaries like a boss (WIP)
Rust
4
star
40

orhun.github.io

Personal website
HTML
4
star
41

theattyr

A terminal theatre for playing VT100 art and animations
Rust
4
star
42

godsings

https://melody.godsays.xyz
Python
3
star
43

base16-kermit

Base16 for kermit
Mustache
3
star
44

parseit

A simple text file parsing library powered by regex and glob patterns
Rust
3
star
45

typewriter

Turn your keyboard into a typewriter (WIP)
Rust
2
star
46

firebox-auth-cracker

A CLI tool to brute force the authentication signature of WatchGuard's Firebox
Rust
2
star
47

playfair-rs

Playfair cipher implemented in Rust
Rust
2
star
48

rust-arch-lto

Rust + ABS + LTO = 🤯 (PoC)
Shell
1
star
49

abstractapi-rs

Rust API bindings for the Abstract HTTP API
Rust
1
star
50

rust-tui-example

A very simple TUI program to demonstrate on Rust Munich Meetup #8
Rust
1
star
51

ytpls

[experimental] YouTube Playlist Synchronizer backed by yt-dl & git
Rust
1
star