Skip to content

Commit 3c923e7

Browse files
committed
Merge remote-tracking branch 'origin/main' into saschagrunert-suggestions
2 parents 9bd6349 + 97a222b commit 3c923e7

34 files changed

+520
-255
lines changed

.github/workflows/cli.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,17 @@ jobs:
9898
run: |
9999
git diff --exit-code
100100
git diff --cached --exit-code
101+
102+
publish:
103+
if: startswith(github.ref, 'refs/tags/')
104+
name: publish
105+
runs-on: ubuntu-latest
106+
steps:
107+
- name: Checkout Code
108+
uses: actions/checkout@v3
109+
110+
- name: Publish Docs
111+
uses: mhausenblas/mkdocs-deploy-gh-pages@master
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.MKDOCS_PUBLISH_GITHUB_TOKEN }}
114+
REQUIREMENTS: mkdocs-requirements.txt

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
*.coverprofile
22
*.orig
3-
node_modules/
43
vendor
54
.idea
65
internal/*/built-example
76
coverage.txt
87
/.local/
8+
/site/
99

1010
*.exe

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,15 @@ gfmrun:
3030
.PHONY: toc
3131
toc:
3232
go run internal/build/build.go toc docs/v2/manual.md
33+
34+
.PHONY: docs
35+
docs:
36+
mkdocs build
37+
38+
.PHONY: docs-deps
39+
docs-deps:
40+
pip install -r mkdocs-requirements.txt
41+
42+
.PHONY: serve-docs
43+
serve-docs:
44+
mkdocs serve

docs/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cli.urfave.org

docs/CODE_OF_CONDUCT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../CODE_OF_CONDUCT.md

docs/CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,28 @@ line help system which may be consulted for further information, e.g.:
9898
go run internal/genflags/cmd/genflags/main.go --help
9999
```
100100

101+
#### docs output
102+
103+
The documentation in the `docs` directory is automatically built via `mkdocs` into a
104+
static site and published when releases are pushed (see [RELEASING](./RELEASING/)). There
105+
is no strict requirement to build the documentation when developing locally, but the
106+
following `make` targets may be used if desired:
107+
108+
```sh
109+
# install documentation dependencies with `pip`
110+
make docs-deps
111+
```
112+
113+
```sh
114+
# build the static site in `./site`
115+
make docs
116+
```
117+
118+
```sh
119+
# start an mkdocs development server
120+
make serve-docs
121+
```
122+
101123
### pull requests
102124

103125
Please feel free to open a pull request to fix a bug or add a feature. The @urfave/cli

docs/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Welcome to urfave/cli
2+
3+
[![GoDoc](https://godoc.org/github.com/urfave/cli?status.svg)](https://pkg.go.dev/github.com/urfave/cli/v2)
4+
[![codebeat](https://codebeat.co/badges/0a8f30aa-f975-404b-b878-5fab3ae1cc5f)](https://codebeat.co/projects/gb.xjqchip.workers.dev-urfave-cli)
5+
[![Go Report Card](https://goreportcard.com/badge/urfave/cli)](https://goreportcard.com/report/urfave/cli)
6+
[![codecov](https://codecov.io/gh/urfave/cli/branch/main/graph/badge.svg)](https://codecov.io/gh/urfave/cli)
7+
8+
`urfave/cli` is a simple, fast, and fun package for building command line apps in Go. The
9+
goal is to enable developers to write fast and distributable command line applications in
10+
an expressive way.
11+
12+
These are the guides for each major supported version:
13+
14+
- [`v2`](./v2/)
15+
- [`v1`](./v1/)
16+
17+
In addition to the version-specific guides, these other documents are available:
18+
19+
- [CONTRIBUTING](./CONTRIBUTING/)
20+
- [CODE OF CONDUCT](./CODE_OF_CONDUCT/)
21+
- [RELEASING](./RELEASING/)

docs/migrate-v1-to-v2.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
Migration Guide: v1 to v2
2-
===
3-
1+
# Migration Guide: v1 to v2
42

53
v2 has a number of breaking changes but converting is relatively
64
straightforward: make the changes documented below then resolve any
@@ -11,25 +9,6 @@ If you find any issues not covered by this document, please post a
119
comment on [Issue 921](https://github.com/urfave/cli/issues/921) or
1210
consider sending a PR to help improve this guide.
1311

14-
<!-- toc -->
15-
16-
* [Flags before args](#flags-before-args)
17-
* [Import string changed](#import-string-changed)
18-
* [Flag aliases are done differently](#flag-aliases-are-done-differently)
19-
* [EnvVar is now a list (EnvVars)](#envvar-is-now-a-list-envvars)
20-
* [Actions returns errors](#actions-returns-errors)
21-
* [cli.Flag changed](#cliflag-changed)
22-
* [Commands are now lists of pointers](#commands-are-now-lists-of-pointers)
23-
* [Lists of commands should be pointers](#lists-of-commands-should-be-pointers)
24-
* [Appending Commands](#appending-commands)
25-
* [GlobalString, GlobalBool and its likes are deprecated](#globalstring-globalbool-and-its-likes-are-deprecated)
26-
* [BoolTFlag and BoolT are deprecated](#booltflag-and-boolt-are-deprecated)
27-
* [&cli.StringSlice{""} replaced with cli.NewStringSlice("")](#clistringslice-replaced-with-clinewstringslice)
28-
* [Replace deprecated functions](#replace-deprecated-functions)
29-
* [Everything else](#everything-else)
30-
31-
<!-- tocstop -->
32-
3312
# Flags before args
3413

3514
In v2 flags must come before args. This is more POSIX-compliant. You

docs/v1/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
manual.md

docs/v1/manual.md

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,4 @@
1-
cli v1 manual
2-
===
3-
4-
<!-- toc -->
5-
6-
- [Getting Started](#getting-started)
7-
- [Examples](#examples)
8-
* [Arguments](#arguments)
9-
* [Flags](#flags)
10-
+ [Placeholder Values](#placeholder-values)
11-
+ [Alternate Names](#alternate-names)
12-
+ [Ordering](#ordering)
13-
+ [Values from the Environment](#values-from-the-environment)
14-
+ [Values from files](#values-from-files)
15-
+ [Values from alternate input sources (YAML, TOML, and others)](#values-from-alternate-input-sources-yaml-toml-and-others)
16-
+ [Precedence](#precedence)
17-
* [Subcommands](#subcommands)
18-
* [Subcommands categories](#subcommands-categories)
19-
* [Exit code](#exit-code)
20-
* [Combining short options](#combining-short-options)
21-
* [Bash Completion](#bash-completion)
22-
+ [Enabling](#enabling)
23-
+ [Distribution](#distribution)
24-
+ [Customization](#customization)
25-
* [Generated Help Text](#generated-help-text)
26-
+ [Customization](#customization-1)
27-
* [Version Flag](#version-flag)
28-
+ [Customization](#customization-2)
29-
+ [Full API Example](#full-api-example)
30-
* [Migrating to V2](#migrating-to-v2)
31-
32-
<!-- tocstop -->
1+
# v1 guide
332

343
## Getting Started
354

docs/v2/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
manual.md

docs/v2/manual.md

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,4 @@
1-
cli v2 manual
2-
===
3-
4-
<!-- toc -->
5-
6-
- [Migrating From Older Releases](#migrating-from-older-releases)
7-
- [Getting Started](#getting-started)
8-
- [Examples](#examples)
9-
* [Arguments](#arguments)
10-
* [Flags](#flags)
11-
+ [Placeholder Values](#placeholder-values)
12-
+ [Alternate Names](#alternate-names)
13-
+ [Ordering](#ordering)
14-
+ [Values from the Environment](#values-from-the-environment)
15-
+ [Values from files](#values-from-files)
16-
+ [Values from alternate input sources (YAML, TOML, and others)](#values-from-alternate-input-sources-yaml-toml-and-others)
17-
+ [Required Flags](#required-flags)
18-
+ [Default Values for help output](#default-values-for-help-output)
19-
+ [Precedence](#precedence)
20-
* [Subcommands](#subcommands)
21-
* [Subcommands categories](#subcommands-categories)
22-
* [Exit code](#exit-code)
23-
* [Combining short options](#combining-short-options)
24-
* [Bash Completion](#bash-completion)
25-
+ [Default auto-completion](#default-auto-completion)
26-
+ [Custom auto-completion](#custom-auto-completion)
27-
+ [Enabling](#enabling)
28-
+ [Distribution and Persistent Autocompletion](#distribution-and-persistent-autocompletion)
29-
+ [Customization](#customization)
30-
+ [ZSH Support](#zsh-support)
31-
+ [ZSH default auto-complete example](#zsh-default-auto-complete-example)
32-
+ [ZSH custom auto-complete example](#zsh-custom-auto-complete-example)
33-
+ [PowerShell Support](#powershell-support)
34-
* [Generated Help Text](#generated-help-text)
35-
+ [Customization](#customization-1)
36-
* [Version Flag](#version-flag)
37-
+ [Customization](#customization-2)
38-
* [Timestamp Flag](#timestamp-flag)
39-
* [Suggestions](#suggestions)
40-
* [Full API Example](#full-api-example)
41-
42-
<!-- tocstop -->
43-
44-
## Migrating From Older Releases
45-
46-
There are a small set of breaking changes between v1 and v2.
47-
Converting is relatively straightforward and typically takes less than
48-
an hour. Specific steps are included in
49-
[Migration Guide: v1 to v2](../migrate-v1-to-v2.md). Also see the [pkg.go.dev docs](https://pkg.go.dev/github.com/urfave/cli/v2) for v2 API documentation.
1+
# v2 guide
502

513
## Getting Started
524

@@ -1722,3 +1674,11 @@ func wopAction(c *cli.Context) error {
17221674
return nil
17231675
}
17241676
```
1677+
1678+
## Migrating From Older Releases
1679+
1680+
There are a small set of breaking changes between v1 and v2.
1681+
Converting is relatively straightforward and typically takes less than
1682+
an hour. Specific steps are included in
1683+
[Migration Guide: v1 to v2](../migrate-v1-to-v2.md). Also see the [pkg.go.dev docs](https://pkg.go.dev/github.com/urfave/cli/v2) for v2 API documentation.
1684+

flag_bool.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ import (
66
"strconv"
77
)
88

9-
// IsRequired returns whether or not the flag is required
10-
func (f *BoolFlag) IsRequired() bool {
11-
return f.Required
12-
}
13-
149
// TakesValue returns true of the flag takes a value, otherwise false
1510
func (f *BoolFlag) TakesValue() bool {
1611
return false
@@ -27,11 +22,6 @@ func (f *BoolFlag) GetValue() string {
2722
return ""
2823
}
2924

30-
// IsVisible returns true if the flag is not hidden, otherwise false
31-
func (f *BoolFlag) IsVisible() bool {
32-
return !f.Hidden
33-
}
34-
3525
// GetDefaultText returns the default text for this flag
3626
func (f *BoolFlag) GetDefaultText() string {
3727
if f.DefaultText != "" {

flag_duration.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ import (
66
"time"
77
)
88

9-
// IsRequired returns whether or not the flag is required
10-
func (f *DurationFlag) IsRequired() bool {
11-
return f.Required
12-
}
13-
149
// TakesValue returns true of the flag takes a value, otherwise false
1510
func (f *DurationFlag) TakesValue() bool {
1611
return true
@@ -27,11 +22,6 @@ func (f *DurationFlag) GetValue() string {
2722
return f.Value.String()
2823
}
2924

30-
// IsVisible returns true if the flag is not hidden, otherwise false
31-
func (f *DurationFlag) IsVisible() bool {
32-
return !f.Hidden
33-
}
34-
3525
// GetDefaultText returns the default text for this flag
3626
func (f *DurationFlag) GetDefaultText() string {
3727
if f.DefaultText != "" {

flag_float64.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ import (
66
"strconv"
77
)
88

9-
// IsRequired returns whether or not the flag is required
10-
func (f *Float64Flag) IsRequired() bool {
11-
return f.Required
12-
}
13-
149
// TakesValue returns true of the flag takes a value, otherwise false
1510
func (f *Float64Flag) TakesValue() bool {
1611
return true
@@ -40,11 +35,6 @@ func (f *Float64Flag) GetEnvVars() []string {
4035
return f.EnvVars
4136
}
4237

43-
// IsVisible returns true if the flag is not hidden, otherwise false
44-
func (f *Float64Flag) IsVisible() bool {
45-
return !f.Hidden
46-
}
47-
4838
// Apply populates the flag given the flag set and environment
4939
func (f *Float64Flag) Apply(set *flag.FlagSet) error {
5040
if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok {

flag_float64_slice.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ func (f *Float64SliceFlag) String() string {
8181
return withEnvHint(f.GetEnvVars(), stringifyFloat64SliceFlag(f))
8282
}
8383

84-
// IsRequired returns whether or not the flag is required
85-
func (f *Float64SliceFlag) IsRequired() bool {
86-
return f.Required
87-
}
88-
8984
// TakesValue returns true if the flag takes a value, otherwise false
9085
func (f *Float64SliceFlag) TakesValue() bool {
9186
return true
@@ -105,11 +100,6 @@ func (f *Float64SliceFlag) GetValue() string {
105100
return ""
106101
}
107102

108-
// IsVisible returns true if the flag is not hidden, otherwise false
109-
func (f *Float64SliceFlag) IsVisible() bool {
110-
return !f.Hidden
111-
}
112-
113103
// GetDefaultText returns the default text for this flag
114104
func (f *Float64SliceFlag) GetDefaultText() string {
115105
if f.DefaultText != "" {

flag_generic.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ type Generic interface {
1111
String() string
1212
}
1313

14-
// IsRequired returns whether or not the flag is required
15-
func (f *GenericFlag) IsRequired() bool {
16-
return f.Required
17-
}
18-
1914
// TakesValue returns true of the flag takes a value, otherwise false
2015
func (f *GenericFlag) TakesValue() bool {
2116
return true
@@ -35,11 +30,6 @@ func (f *GenericFlag) GetValue() string {
3530
return ""
3631
}
3732

38-
// IsVisible returns true if the flag is not hidden, otherwise false
39-
func (f *GenericFlag) IsVisible() bool {
40-
return !f.Hidden
41-
}
42-
4333
// GetDefaultText returns the default text for this flag
4434
func (f *GenericFlag) GetDefaultText() string {
4535
if f.DefaultText != "" {

flag_int.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ import (
66
"strconv"
77
)
88

9-
// IsRequired returns whether or not the flag is required
10-
func (f *IntFlag) IsRequired() bool {
11-
return f.Required
12-
}
13-
149
// TakesValue returns true of the flag takes a value, otherwise false
1510
func (f *IntFlag) TakesValue() bool {
1611
return true
@@ -27,11 +22,6 @@ func (f *IntFlag) GetValue() string {
2722
return fmt.Sprintf("%d", f.Value)
2823
}
2924

30-
// IsVisible returns true if the flag is not hidden, otherwise false
31-
func (f *IntFlag) IsVisible() bool {
32-
return !f.Hidden
33-
}
34-
3525
// GetDefaultText returns the default text for this flag
3626
func (f *IntFlag) GetDefaultText() string {
3727
if f.DefaultText != "" {

0 commit comments

Comments
 (0)