Skip to content
项目

关于

一个用于在 Go 中构建命令行工具的声明式、简单、快速且有趣的软件包

开发工具

这些数字如何统计

实测星标增长

24小时
-1
7天
+10
15天
+13
1个月
+34

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Welcome to urfave/cli

Go Reference Go Report Card codecov Tests status

urfave/cli is a declarative, simple, fast, and fun package for building command line tools in Go featuring:

  • commands and subcommands with alias and prefix match support
  • flexible and permissive help system
  • dynamic shell completion for bash, zsh, fish, and powershell
  • no dependencies except Go standard library
  • input flags for simple types, slices of simple types, time, duration, and others
  • compound short flag support (-a -b -c can be shortened to -abc)
  • documentation generation in man and Markdown (supported via the urfave/cli-docs module)
  • input lookup from:
    • environment variables
    • plain text files
    • structured file formats (supported via the urfave/cli-altsrc module)

Documentation

See the hosted documentation website at https://cli.urfave.org. Contents of this website are built from the ./docs directory.

Build tags

You can use the following build tags:

urfave_cli_no_template

When set, the default help and fish completion are rendered without using text/template, which makes the Go linker disable dead code elimination (see Binary Size). The output is the same, but help templates can not be customized:

  • RootCommandHelpTemplate, CommandHelpTemplate, SubcommandHelpTemplate and FishCompletionTemplate are constants;
  • if the default help printer is used with a custom template (such as CustomRootCommandHelpTemplate or CustomHelpTemplate), it panics;
  • custom template functions other than wrap and wrapAt are ignored.

Replacing cli.HelpPrinter works as usual, except it receives "root", "command" or "subcommand" as templ instead of the default template text (a custom template is passed as is).

Support

Check the Q&A discussions. If you don't find answer to your question, create a new discussion.

If you found a bug or have a feature request, create a new issue.

Please keep in mind that this project is run by unpaid volunteers.

License

See LICENSE.

探索相关项目

加载中…