Skip to content

Commit

Permalink
Porting #1452 to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballhat committed Oct 1, 2022
1 parent c0a0f27 commit 3dbbd5c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 39 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/cli.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: [1.18.x]
go: [1.18.x, 1.19.x]
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -30,12 +30,16 @@ jobs:
- name: Set PATH
run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"

- name: install goimports
if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
run: GOBIN=${PWD}/.local/bin go install golang.org/x/tools/cmd/goimports@latest

- name: Checkout Code
uses: actions/checkout@v3

- name: GOFMT Check
if: matrix.go == '1.18.x' && matrix.os == 'ubuntu-latest'
run: test -z $(gofmt -l .)
- name: goimports Check
if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
run: test -z $(goimports -l .)

- name: vet
run: go run internal/build/build.go vet
Expand All @@ -56,7 +60,7 @@ jobs:
run: go run internal/build/build.go -tags urfave_cli_no_docs check-binary-size

- name: Upload coverage to Codecov
if: success() && matrix.go == '1.18.x' && matrix.os == 'ubuntu-latest'
if: success() && matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
Expand All @@ -68,7 +72,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.19.x

- name: Use Node.js 16
uses: actions/setup-node@v3
Expand Down
13 changes: 7 additions & 6 deletions .gitignore
@@ -1,11 +1,12 @@
*.coverprofile
*.exe
*.orig
vendor
.*envrc
.envrc
.idea
internal/*/built-example
coverage.txt
/.local/
/site/
/cmd/urfave-cli-genflags/urfave-cli-genflags

*.exe
/site/
coverage.txt
internal/*/built-example
vendor
29 changes: 15 additions & 14 deletions cli.go
@@ -1,23 +1,24 @@
// Package cli provides a minimal framework for creating and organizing command line
// Go applications. cli is designed to be easy to understand and write, the most simple
// cli application can be written as follows:
// func main() {
// (&cli.App{}).Run(os.Args)
// }
//
// func main() {
// (&cli.App{}).Run(os.Args)
// }
//
// Of course this application does not do much, so let's make this an actual application:
// func main() {
// app := &cli.App{
// Name: "greet",
// Usage: "say a greeting",
// Action: func(c *cli.Context) error {
// fmt.Println("Greetings")
// return nil
// },
// }
// func main() {
// app := &cli.App{
// Name: "greet",
// Usage: "say a greeting",
// Action: func(c *cli.Context) error {
// fmt.Println("Greetings")
// return nil
// },
// }
//
// app.Run(os.Args)
// }
// app.Run(os.Args)
// }
package cli

//go:generate go run cmd/urfave-cli-genflags/main.go
26 changes: 13 additions & 13 deletions godoc-current.txt
Expand Up @@ -5,24 +5,24 @@ line Go applications. cli is designed to be easy to understand and write,
the most simple cli application can be written as follows:

func main() {
(&cli.App{}).Run(os.Args)
(&cli.App{}).Run(os.Args)
}

Of course this application does not do much, so let's make this an actual
application:

func main() {
app := &cli.App{
Name: "greet",
Usage: "say a greeting",
Action: func(c *cli.Context) error {
fmt.Println("Greetings")
return nil
},
}

app.Run(os.Args)
}
func main() {
app := &cli.App{
Name: "greet",
Usage: "say a greeting",
Action: func(c *cli.Context) error {
fmt.Println("Greetings")
return nil
},
}

app.Run(os.Args)
}

VARIABLES

Expand Down

0 comments on commit 3dbbd5c

Please sign in to comment.