Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/jba/cli

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/jba/cli

  • v0.6.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

cli: A Command-Line Package

Why another package for simplifying command-line programs?

My typical command-line program is a development tool that doesn't require much beyond some simple, in-program documentation. So I wanted something easy to use and understand. I find many of the existing packages dauntingly complex.

I also had the idea of using struct tags to describe flags and arguments. This virtually eliminates the painful boilerplate of checking the number of arguments and then parsing the strings. Instead, one defines a struct with fields of the desired types, and the struct's Run method has those fields at hand, assigned and validated. I've only seen this idea in one other package, github.com/mkideal/cli, but there it is only applied to flags, not positional arguments.

Features

  • Define flags and arguments with struct field tags.

  • Nested commands.

  • Shell completion.

  • Multi-valued flags: parsing comma-separated flag values into a slice.

  • Oneofs: specify a list of valid strings for a flag or argument.

FAQs

Package last updated on 16 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc