### Heroku CLI Help Text Example Source: https://clig.dev/index An example of help text for a Heroku CLI command, demonstrating a concise description, usage instructions, and options, formatted with bold headings. ```bash $ heroku apps --help list your apps USAGE $ heroku apps OPTIONS -A, --all include apps in all teams ``` -------------------------------- ### jq Help Text Example Source: https://clig.dev/index Demonstrates concise help text output for the 'jq' command-line JSON processor. It includes a brief description, usage examples, and an instruction to use '--help' for more details. ```bash $ jq jq - commandline JSON processor [version 1.6] Usage: jq [options] [file...] jq [options] --args [strings...] jq [options] --jsonargs [JSON_TEXTS...] jq is a tool for processing JSON inputs, applying the given filter to its JSON text inputs and producing the filter's results as JSON on standard output. The simplest filter is ., which copies jq's input to its output unmodified (except for formatting, but note that IEEE754 is used for number representation internally, with all that that implies). For more advanced filters see the jq(1) manpage ("man jq") and/or https://stedolan.github.io/jq Example: $ echo '{"foo": 0}' | jq . { "foo": 0 } For a listing of options, use jq --help. ``` -------------------------------- ### Heroku Apps Command Example Source: https://clig.dev/index An example demonstrating how to list applications using the `heroku apps` command. The output distinguishes between apps in the user's personal account and apps shared with other teams. ```bash $ heroku apps === My Apps example example2 === Collaborated Apps theirapp other@owner.name ``` -------------------------------- ### Git Help Text Structure Example Source: https://clig.dev/index Shows the structure of 'git' command's help text, featuring a usage synopsis, common commands categorized by function, and instructions for further help. ```bash $ git usage: git [--version] [--help] [-C ] [-c =] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] [] These are common Git commands used in various situations: start a working area (see also: git help tutorial) clone Clone a repository into a new directory init Create an empty Git repository or reinitialize an existing one work on the current change (see also: git help everyday) add Add file contents to the index mv Move or rename a file, a directory, or a symlink reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index examine the history and state (see also: git help revisions) bisect Use binary search to find the commit that introduced a bug grep Print lines matching a pattern log Show commit logs show Show various types of objects status Show the working tree status โ€ฆ ``` -------------------------------- ### Example of CLI Command Usage Source: https://clig.dev/index Demonstrates a typical command-line interface (CLI) usage where a command `mycmd` executes a `run` subcommand followed by arguments. This example illustrates a potential design pitfall regarding catch-all subcommands. ```bash $ mycmd run echo "hello world" ``` -------------------------------- ### Git Push Output Example Source: https://clig.dev/index Provides an example of the detailed output typically generated by `git push`, showing object enumeration, compression, and delta operations. This exemplifies how to inform the user about state changes and the progress of operations. ```bash $ git push Enumerating objects: 18, done. Counting objects: 100% (18/18), done. Delta compression using up to 8 threads Compressing objects: 100% (10/10), done. Writing objects: 100% (10/10), 2.09 KiB | 2.09 MiB/s, done. Total 10 (delta 8), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (8/8), completed with 8 local objects. To github.com:replicate/replicate.git + 6c22c90...a2a5217 bfirsh/fix-delete -> bfirsh/fix-delete ``` -------------------------------- ### Progress Bar Examples for Parallel Tasks Source: https://clig.dev/index Demonstrates the use of progress bars for showing the status of long-running operations, especially in parallel execution. Libraries like tqdm (Python) and schollz/progressbar (Go) are recommended for managing multiple progress indicators. ```text $ docker image pull ruby Using default tag: latest latest: Pulling from library/ruby 6c33745f49b4: Pull complete ef072fc32a84: Extracting [================================================> ] 7.569MB/7.812MB c0afb8e68e0b: Download complete d599c07d28e6: Download complete f2ecc74db11a: Downloading [=======================> ] 89.11MB/192.3MB 3568445c8bf2: Download complete b0efebc74f25: Downloading [===========================================> ] 19.88MB/22.88MB 9cb1ba6838a0: Download complete ``` -------------------------------- ### Example `ls` Command Output (Permissions and File Info) Source: https://clig.dev/index Demonstrates the use of ASCII art, specifically the output format of the `ls` command, to present file information including permissions, ownership, size, and modification date in a scannable way. This format allows users to ignore details initially and progressively learn to interpret more information. ```shell -rw-r--r-- 1 root root 68 Aug 22 23:20 resolv.conf lrwxrwxrwx 1 root root 13 Mar 14 20:24 rmt -> /usr/sbin/rmt drwxr-xr-x 4 root root 4.0K Jul 20 14:51 security drwxr-xr-x 2 root root 4.0K Jul 20 14:53 selinux -rw-r----- 1 root shadow 501 Jul 20 14:44 shadow -rw-r--r-- 1 root root 116 Jul 20 14:43 shells drwxr-xr-x 2 root root 4.0K Jul 20 14:57 skel -rw-r--r-- 1 root root 0 Jul 20 14:43 subgid -rw-r--r-- 1 root root 0 Jul 20 14:43 subuid ``` -------------------------------- ### NPM LS Command Documentation Source: https://clig.dev/index Synopsis and description for the `npm ls` command, used to list installed packages and their dependencies in a tree structure. This is a standard command for package management in Node.js projects. ```man NPM-LS(1) NPM-LS(1) NAME npm-ls - List installed packages SYNOPSIS npm ls [[<@scope>/] ...] aliases: list, la, ll DESCRIPTION This command will print to stdout all the versions of packages that are installed, as well as their dependencies, in a tree-structure. ... ``` -------------------------------- ### Git Status Output Example Source: https://clig.dev/index Shows the output of `git status`, which provides comprehensive information about the current state of the Git repository. This includes branch information, staged/unstaged changes, and suggestions for next actions. ```bash $ git status On branch bfirsh/fix-delete Your branch is up to date with 'origin/bfirsh/fix-delete'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: cli/pkg/cli/rm.go no changes added to commit (use "git add" and/or "git commit -a") ``` -------------------------------- ### Docker Compose Ctrl-C Graceful Shutdown Example Source: https://clig.dev/index Shows how a CLI tool like Docker Compose handles Ctrl-C during graceful shutdown. It provides an option to force immediate termination upon a second Ctrl-C press, demonstrating robust signal handling. ```bash $ docker-compose up โ€ฆ ^CGracefully stopping... (press Ctrl+C again to force) ``` -------------------------------- ### Conditional Output Formatting (--plain, --json) Source: https://clig.dev/index Demonstrates how to implement flags like `--plain` for tabular output and `--json` for structured JSON output. This allows users to choose the most suitable format for their needs, whether for human readability or programmatic consumption. ```python import argparse import json def generate_output(data, plain=False, json_output=False): if json_output: return json.dumps(data, indent=2) elif plain: # Logic for plain, tabular output lines = [] for row in data: lines.append("\t".join(map(str, row))) return "\n".join(lines) else: # Default human-readable output (could be formatted) return "\n".join(map(str, data)) parser = argparse.ArgumentParser() parser.add_argument('--plain', action='store_true', help='Output in plain, tabular text format.') parser.add_argument('--json', action='store_true', help='Output in JSON format.') args = parser.parse_args() sample_data = [["col1", "col2"], [1, 2], [3, 4]] print(generate_output(sample_data, plain=args.plain, json_output=args.json)) ``` -------------------------------- ### Order-independent arguments in mycmd (Bash) Source: https://clig.dev/index Illustrates how CLI arguments and flags can be designed to be order-independent, improving user experience by allowing flags to be placed before or after subcommands. This example shows a working and non-working scenario. ```bash mycmd --foo=1 subcmd works $ mycmd subcmd --foo=1 unknown flag: --foo ``` -------------------------------- ### Example of Future-Proof CLI Command Usage Source: https://clig.dev/index Illustrates an alternative CLI usage where a command `mycmd` directly accepts arguments, implying a default subcommand execution. This approach avoids the need for an explicit `run` subcommand but introduces risks if new subcommands share initial argument names. ```bash $ mycmd echo "hello world" ``` -------------------------------- ### Emoji and Symbols in CLI Output (yubikey-agent) Source: https://clig.dev/index Illustrates the use of emoji and symbols to enhance CLI output clarity and draw attention to important information. This example from `yubikey-agent` uses emojis like ๐Ÿ”, โŒ, ๐Ÿงช, โœ…, ๐Ÿค, and ๐Ÿ”‘ to structure messages, indicate status, and provide guidance. ```shell $ yubikey-agent -setup ๐Ÿ” The PIN is up to 8 numbers, letters, or symbols. Not just numbers! โŒ The key will be lost if the PIN and PUK are locked after 3 incorrect tries. Choose a new PIN/PUK: Repeat the PIN/PUK: ๐Ÿงช Retriculating splines โ€ฆ โœ… Done! This YubiKey is secured and ready to go. ๐Ÿค When the YubiKey blinks, touch it to authorize the login. ๐Ÿ”‘ Here's your new shiny SSH public key: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCEJ/ UwlHnUFXgENO3ifPZd8zoSKMxESxxot4tMgvfXjmRp5G3BGrAnonncE7Aj11pn3SSYgEcrrn2sMyLGpVS0= ๐Ÿ’ญ Remember: everything breaks, have a backup plan for when this YubiKey does. ``` -------------------------------- ### Suppressing Non-Essential Output (-q) Source: https://clig.dev/index Illustrates the use of a quiet flag (e.g., `-q`) to suppress non-essential output. This is beneficial for scripts that need to avoid verbose messages and focus only on critical information or errors. ```python import argparse def process_data(verbose=True): if verbose: print("Processing step 1...") # ... actual processing ... if verbose: print("Processing complete.") parser = argparse.ArgumentParser() parser.add_argument('-q', '--quiet', action='store_true', help='Suppress non-essential output.') args = parser.parse_args() process_data(verbose=not args.quiet) ``` -------------------------------- ### Help Display Triggers Source: https://clig.dev/index Illustrates scenarios where extensive help text should be displayed, triggered by '-h' or '--help' flags, or 'help' subcommands. ```bash $ myapp $ myapp --help $ myapp -h $ myapp help $ myapp help subcommand $ myapp subcommand --help $ myapp subcommand -h ``` -------------------------------- ### Heroku CLI Help Text Handling Source: https://clig.dev/index Demonstrates how the Heroku CLI handles unknown commands by suggesting alternatives. This feature helps users correct typos or discover the correct command syntax. ```bash $ heroku pss โ€บ Warning: pss is not a heroku command. Did you mean ps? [y/n]: ``` -------------------------------- ### Pager Configuration for `less` Command Source: https://clig.dev/index Provides a recommended set of options for using the `less` pager with CLI output. The options `-FIRX` are suggested to improve the user experience by not paging if content fits the screen, ignoring case in searches, enabling color and formatting, and keeping content visible upon exit. ```shell less -FIRX ``` -------------------------------- ### Heroku CLI Commands List Source: https://clig.dev/index A list of available Heroku CLI commands for managing applications. These commands cover a wide range of functionalities from creation and destruction to information retrieval and transfer. ```bash apps:create creates a new app apps:destroy permanently destroy an app apps:errors view app errors apps:favorites list favorited apps apps:info show detailed app information apps:join add yourself to a team app apps:leave remove yourself from a team app apps:lock prevent team members from joining an app apps:open open the app in a web browser apps:rename rename an app apps:stacks show the list of available stacks apps:transfer transfer applications to another user or team apps:unlock unlock an app so any team member can join ``` -------------------------------- ### Check if Output is a TTY (Go) Source: https://clig.dev/index Verifies if the standard output is connected to a terminal in Go. This enables dynamic output formatting, ensuring optimal readability for both humans and machines. Utilizes the `os/isatty` package. ```go package main import ( "fmt" "os" "github.com/mattn/go-isatty" ) func main() { isTty := isatty.IsTerminal(os.Stdout.Fd()) fmt.Printf("Is TTY: %t\n", isTty) } ``` -------------------------------- ### Reading from stdin with tar (Bash) Source: https://clig.dev/index Demonstrates how to use the '-' character to read from standard input when a command expects a file, enabling piping of data between commands without temporary files. This is useful for processing data streams. ```bash $ curl https://example.com/something.tar.gz | tar xvf - ``` -------------------------------- ### Heroku CLI Options Source: https://clig.dev/index Command-line options for the Heroku CLI that filter or modify command behavior. These options can be used with various Heroku commands to customize output or target specific resources. ```bash -p, --personal list apps in personal account when a default team is set -s, --space=space filter by space -t, --team=team team to use --json output in json format ``` -------------------------------- ### Check if Output is a TTY (Node.js) Source: https://clig.dev/index Checks if the standard output stream is a TTY in Node.js, allowing for conditional formatting of output based on whether a human or another program is consuming it. Uses the `process.stdout.isTTY` property. ```javascript const isTty = process.stdout.isTTY; console.log(`Is TTY: ${isTty}`); ``` -------------------------------- ### Check if Output is a TTY (Python) Source: https://clig.dev/index Determines if the standard output stream is connected to a terminal (TTY). This is crucial for deciding whether to use human-readable or machine-readable output formats. It relies on the `sys` module. ```python import sys is_tty = sys.stdout.isatty() print(f"Is TTY: {is_tty}") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.