← 全部工具

juanibiapina/sub

热度 75 更新于 网络与系统管理

Shell scripts with superpowers 🦸‍♂️

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

Sub

Scripts with superpowers.

sub is a tool for organizing scripts into a unified command-line interface. It allows the dynamic creation of a CLI from a directory (and subdirectories) of scripts with support for documentation, argument validation, and completions.

Table of Contents

  • Key features
  • Demo
  • Installation
  • Setup
  • Examples
  • As an alias
  • As an executable
  • Usage
  • Documenting commands
  • Validating arguments
  • Parsing arguments
  • Raw arguments
  • Completions
  • Nested subcommands
  • Aliases
  • Sharing code between scripts
  • Caching
  • Migrating to Sub 2.x
  • change --bin to --executable
  • Usage comments
  • Help, commands and completions
  • Inspiration

Key features

  • Display help: Display usage and documentation for scripts.
  • Validate arguments: Validate arguments to scripts based on documentation.
  • Parse arguments: Automatically parse arguments to scripts so getopts is not needed.
  • Nested subcommands: Supports nested directories for hierarchical command structures.
  • Aliases: Supports aliases for subcommands.
  • Completions: Supports auto completion of subcommands.
  • Cross-platform: Works on Linux and macOS.

Demo

Installation

<details <summaryHomebrew</summary

brew install juanibiapina/tap/sub

</details

<details <summaryNix with Flakes (install the sub binary)</summary

Add sub to your flake inputs: