Skip to content

Commit

Permalink
Update many v1 things
Browse files Browse the repository at this point in the history
including:
- testing on `windows-latest` in CI
- updating license year
- updating badges in README
- removing references to outdated v2 docs
- removing references to `GOPATH`
- removing appveyer config
- introducing stretchr/testify for comparison assertions
- replacing usage of `ioutil`
- updating all dependencies
- removing outdated version-specific test files
  • Loading branch information
meatballhat committed Jan 22, 2023
1 parent 522b9b8 commit b8a6071
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
go: [1.18.x, 1.19.x]
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ vendor
/.local/
/internal/
/site/
package.json
package-lock.json
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Jeremy Saenz & Contributors
Copyright (c) 2023 Jeremy Saenz & Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
49 changes: 10 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,30 @@
cli
===

[![Build Status](https://travis-ci.org/urfave/cli.svg?branch=master)](https://travis-ci.org/urfave/cli)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/rtgk5xufi932pb2v?svg=true)](https://ci.appveyor.com/project/urfave/cli)

[![GoDoc](https://godoc.org/github.com/urfave/cli?status.svg)](https://godoc.org/github.com/urfave/cli)
[![codebeat](https://codebeat.co/badges/0a8f30aa-f975-404b-b878-5fab3ae1cc5f)](https://codebeat.co/projects/github-com-urfave-cli)
[![Run Tests](https://github.com/urfave/cli/actions/workflows/cli.yml/badge.svg?branch=v1-maint)](https://github.com/urfave/cli/actions/workflows/cli.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/urfave/cli/.svg)](https://pkg.go.dev/github.com/urfave/cli/)
[![Go Report Card](https://goreportcard.com/badge/urfave/cli)](https://goreportcard.com/report/urfave/cli)
[![codecov](https://codecov.io/gh/urfave/cli/branch/master/graph/badge.svg)](https://codecov.io/gh/urfave/cli)
[![codecov](https://codecov.io/gh/urfave/cli/branch/v1-maint/graph/badge.svg)](https://codecov.io/gh/urfave/cli)

cli is a simple, fast, and fun package for building command line apps in Go. The
goal is to enable developers to write fast and distributable command line
applications in an expressive way.

## Usage Documentation

Usage documentation exists for each major version

- `v1` - [./docs/v1/manual.md](./docs/v1/manual.md)
- `v2` - 🚧 documentation for `v2` is WIP 🚧
Usage documentation for `v1` is available [at the docs
site](https://cli.urfave.org/v1/getting-started/) or in-tree at
[./docs/v1/manual.md](./docs/v1/manual.md)

## Installation

Make sure you have a working Go environment. Go version 1.10+ is supported. [See
the install instructions for Go](http://golang.org/doc/install.html).

### GOPATH

Make sure your `PATH` includes the `$GOPATH/bin` directory so your commands can
be easily used:
```
export PATH=$PATH:$GOPATH/bin
```
Make sure you have a working Go environment. Go version 1.18+ is supported.

### Supported platforms

cli is tested against multiple versions of Go on Linux, and against the latest
released version of Go on OS X and Windows. For full details, see
[`./.travis.yml`](./.travis.yml) and [`./appveyor.yml`](./appveyor.yml).
cli is tested against multiple versions of Go on Linux, and against the latest released
version of Go on OS X and Windows. For full details, see
[./.github/workflows/cli.yml](./.github/workflows/cli.yml).

### Build tags

Expand All @@ -62,19 +49,3 @@ import (
)
...
```

### Using `v2` releases

**Warning**: `v2` is in a pre-release state.

```
$ go get github.com/urfave/cli.v2
```

```go
...
import (
"github.com/urfave/cli.v2" // imports as package "cli"
)
...
```
28 changes: 0 additions & 28 deletions appveyor.yml

This file was deleted.

4 changes: 2 additions & 2 deletions docs/v1/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ cli v1 manual
* [Version Flag](#version-flag)
+ [Customization](#customization-2)
+ [Full API Example](#full-api-example)
* [Testing](#testing)
* [Migrating to V2](#migrating-to-v2)
- [Testing](#testing)
- [Migrating to V2](#migrating-to-v2)

<!-- tocstop -->

Expand Down
4 changes: 3 additions & 1 deletion docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package cli

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestToMarkdownFull(t *testing.T) {
Expand Down Expand Up @@ -53,6 +55,6 @@ func TestToMan(t *testing.T) {
res, err := app.ToMan()

// Then
expect(t, err, nil)
require.Nil(t, err)
expectFileContent(t, "testdata/expected-doc-full.man", res)
}
10 changes: 6 additions & 4 deletions fish_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package cli

import (
"io/ioutil"
"os"
"testing"

"github.com/stretchr/testify/require"
)

func testApp() *App {
Expand Down Expand Up @@ -66,9 +68,9 @@ func testApp() *App {
}

func expectFileContent(t *testing.T, file, expected string) {
data, err := ioutil.ReadFile(file)
expect(t, err, nil)
expect(t, string(data), expected)
data, err := os.ReadFile(file)
require.Nil(t, err)
require.Equal(t, string(data), expected)
}

func TestFishCompletion(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module github.com/urfave/cli
go 1.11

require (
github.com/BurntSushi/toml v0.3.1
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
gopkg.in/yaml.v2 v2.2.2
github.com/BurntSushi/toml v1.2.1
github.com/cpuguy83/go-md2man/v2 v2.0.2
github.com/stretchr/testify v1.8.1 // indirect
gopkg.in/yaml.v2 v2.4.0
)
31 changes: 21 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
28 changes: 0 additions & 28 deletions go116_test.go

This file was deleted.

33 changes: 0 additions & 33 deletions go117_test.go

This file was deleted.

28 changes: 14 additions & 14 deletions testdata/expected-doc-full.man
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

.SH NAME
.PP
greet \- Some app
greet - Some app


.SH SYNOPSIS
Expand All @@ -16,17 +16,17 @@ greet
.RS

.nf
[\-\-another\-flag|\-b]
[\-\-flag|\-\-fl|\-f]=[value]
[\-\-socket|\-s]=[value]
[--another-flag|-b]
[--flag|--fl|-f]=[value]
[--socket|-s]=[value]

.fi
.RE


.SH DESCRIPTION
.PP
app [first\_arg] [second\_arg]
app [first_arg] [second_arg]

.PP
\fBUsage\fP:
Expand All @@ -43,13 +43,13 @@ greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...]

.SH GLOBAL OPTIONS
.PP
\fB\-\-another\-flag, \-b\fP: another usage text
\fB--another-flag, -b\fP: another usage text

.PP
\fB\-\-flag, \-\-fl, \-f\fP="":
\fB--flag, --fl, -f\fP="":

.PP
\fB\-\-socket, \-s\fP="": some 'usage' text (default: value)
\fB--socket, -s\fP="": some 'usage' text (default: value)


.SH COMMANDS
Expand All @@ -58,23 +58,23 @@ greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...]
another usage test

.PP
\fB\-\-another\-flag, \-b\fP: another usage text
\fB--another-flag, -b\fP: another usage text

.PP
\fB\-\-flag, \-\-fl, \-f\fP="":
\fB--flag, --fl, -f\fP="":

.SS sub\-config, s, ss
.SS sub-config, s, ss
.PP
another usage test

.PP
\fB\-\-sub\-command\-flag, \-s\fP: some usage text
\fB--sub-command-flag, -s\fP: some usage text

.PP
\fB\-\-sub\-flag, \-\-sub\-fl, \-s\fP="":
\fB--sub-flag, --sub-fl, -s\fP="":

.SH info, i, in
.PP
retrieve generic information

.SH some\-command
.SH some-command

0 comments on commit b8a6071

Please sign in to comment.