Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting to v3 #1510

Merged
merged 98 commits into from Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
dd9cd61
Fix for TimestampFlag.GetValue to return empty string without value
hmiyado Jul 18, 2022
67f592a
Fix HideHelp
Jul 29, 2022
02eb392
Fix After not run
Jul 28, 2022
bc99b58
issue_62: Make slice options more posix like
dearchap Aug 14, 2022
45a1375
Changes from code review
dearchap Aug 15, 2022
2ca9143
Move genflags tool to cmd/ and pin to previous release
meatballhat Aug 14, 2022
d8de3b5
Tidy up top-level go.mod
meatballhat Aug 14, 2022
a5313eb
Add missing go.sum entries for go 1.16.x
meatballhat Aug 14, 2022
cbc7f1a
Use goimports as formatting standard
meatballhat Aug 14, 2022
76bb9f1
Shift supported go versions
meatballhat Aug 14, 2022
1ae70fc
split v1 docs into individual pages
hay-kot Aug 14, 2022
edaf885
breakup v2 documentation
hay-kot Aug 14, 2022
18f8e6d
update sidebar configuration
hay-kot Aug 14, 2022
7cfafe8
add tags plugin
hay-kot Aug 15, 2022
8036eac
add tags and boost for pages
hay-kot Aug 15, 2022
d217a5a
wip: add --walk flag to gfrun to accept directory
hay-kot Aug 15, 2022
87f003f
pass in correct root
hay-kot Aug 15, 2022
2b1a8ca
rename filename to dirPath
hay-kot Aug 15, 2022
42d8058
Fix:(issue_1094) Dont execute Before/After handlers during shell comp…
dearchap Aug 18, 2022
42eb492
Rename function
dearchap Aug 18, 2022
78dac9c
Fix:(issue_1455) Allow bool flags from input altsrc
dearchap Aug 16, 2022
3c6588c
Remove debug println
dearchap Aug 23, 2022
f515798
Revert godoc changes
dearchap Aug 23, 2022
382386a
Add configurable Base to int, uint and uint64 flags
ccremer Aug 25, 2022
9de6fa4
fix: allow required flag with one character
Gerrard-YNWA Aug 14, 2022
9092325
fix: update test case
Gerrard-YNWA Aug 14, 2022
e0db267
adding in boolean alias support
james-prysm Aug 11, 2022
50bbb4a
adding string alias and test
james-prysm Aug 25, 2022
5a5789a
adding int alias and test
james-prysm Aug 25, 2022
c512a28
add support for duration flag
james-prysm Aug 25, 2022
126d238
adding float flag alias support
james-prysm Aug 25, 2022
9630e10
adding alias support to remaining flags and fixing tests
james-prysm Aug 25, 2022
9a33ae8
fixing test
james-prysm Aug 25, 2022
d520bfc
Modify nesting flag apply
Aug 30, 2022
445734d
Update v2 dead link
abousselmi Aug 30, 2022
b539ee7
Fix:(issue_1293) Wrap usage text for commands
dearchap Aug 20, 2022
d89bc4a
Change way to calculate offset
dearchap Aug 24, 2022
96e41a6
Make test case more robust
dearchap Aug 25, 2022
e48d377
Remove add function
dearchap Aug 27, 2022
321d493
Add comment
dearchap Aug 30, 2022
6331815
Add App.UnknownFlagHandler
icholy Aug 2, 2022
e19a34c
Rename App.UnknownFlagHandler to App.InvalidFlagAccessHandler
icholy Aug 8, 2022
4bce542
Traverse parent contexts
icholy Aug 15, 2022
68cd3e8
Fix:(issue_1272) Generic flag not set from env
dearchap Aug 19, 2022
d34a232
Merge remote-tracking branch 'origin/v3-dev-main' into v3-porting
meatballhat Oct 3, 2022
1446649
Use cli/v2 in genflags tool (for now?)
meatballhat Oct 3, 2022
e57f53b
Update cli.yml
sashashura Sep 2, 2022
8609031
Update version of codecov action
meatballhat Sep 5, 2022
31edfd6
Explicitly pass CODECOV_TOKEN
meatballhat Sep 5, 2022
eea567a
Add a few notes to release docs
meatballhat Sep 5, 2022
03487fc
Add count option for bool flags
dearchap Mar 23, 2021
2941bc8
Merge changes onto latest main
dearchap Aug 13, 2022
c4251de
Remove go changes
dearchap Aug 13, 2022
2b0db3b
Update for build
dearchap Aug 16, 2022
c0a2866
Merge main and run tidy
dearchap Aug 28, 2022
2f082d6
Rebase main
dearchap Sep 5, 2022
2f66431
Add to docs
dearchap Sep 5, 2022
b694a25
Update docs
dearchap Sep 5, 2022
cbd62ef
Update godocs
dearchap Sep 5, 2022
3adf8fa
Add args
dearchap Sep 5, 2022
fa3bbf9
Update docs/v2/examples/flags.md
dearchap Sep 5, 2022
c0a8506
Add context.Count
dearchap Sep 5, 2022
6b0a3e8
Add parametrize tests
dearchap Sep 5, 2022
a509290
Add countable interface
dearchap Sep 5, 2022
d58b3c7
Remove keystroke errors
dearchap Sep 6, 2022
fdcbf28
Merge changes from main
dearchap Aug 13, 2022
0764ca2
Rebase
dearchap Aug 15, 2022
7097d0e
Fix tests per latest main
dearchap Aug 15, 2022
7405a90
Fix formatting
dearchap Aug 31, 2022
9bcffd0
Merge from main
dearchap Aug 31, 2022
2a5960c
Add coverage threshold
dearchap Sep 6, 2022
5b96605
Add additional test to fix codecov
dearchap Sep 10, 2022
9c5b385
Add additional test to fix codecov
dearchap Sep 10, 2022
0658d61
Set codecov status thresholds to 5%
meatballhat Sep 10, 2022
e13c16b
Fix: dont generate pointer for dest for Generic flag
dearchap Sep 10, 2022
8e3fa06
Fix: Help name consistency among app/commands and subcommands
dearchap Sep 11, 2022
8cc0a9c
Move more functionality into internal/build/build.go
meatballhat Sep 11, 2022
d9d960a
Run make target after the Makefile is available
meatballhat Sep 11, 2022
2bec081
Use windows compatible path append
meatballhat Sep 11, 2022
0593812
Only run `make v2diff` on go `1.19.x` + `ubuntu-latest`
meatballhat Sep 11, 2022
d6c9f6a
Replace a few more custom make targets
meatballhat Sep 11, 2022
9ed5a09
Use correct env var for global flags
meatballhat Sep 11, 2022
1c3ebfa
Accept the `MKDOCS_REMOTE_GITHUB_TOKEN` var as intended
meatballhat Sep 12, 2022
d2acd0e
Fix:(issue_1197) Set destination field from altsrc for slice flags
dearchap Sep 12, 2022
e9e87f6
Add unit tests
dearchap Sep 12, 2022
a2c3729
fix: Context.Set no such flag
Sep 20, 2022
e2e14ec
feat: flag action
xwjdsh Feb 15, 2022
f9ceca5
Add more tests about flag-level action
xwjdsh Apr 30, 2022
d213683
Rebase main, update flag-spec.yaml to add Action field
xwjdsh May 22, 2022
1e30f50
make v2approve
xwjdsh Sep 15, 2022
126297a
Add more test cases
xwjdsh Sep 17, 2022
4c637d8
Fix:(issue_557) Change app help name
dearchap Aug 21, 2022
57ff098
Fix:(issue_557) Make help output consistent between different invocat…
dearchap Sep 21, 2022
c2ecb44
Remove un-needed func
dearchap Sep 21, 2022
8ef92d2
Remove un-needed func
dearchap Sep 21, 2022
5db9db6
Remove nonexistent phony targets
meatballhat Sep 29, 2022
f8faf77
Post-porting fixes for v3
meatballhat Oct 3, 2022
a851a77
Point docs tests at v3
meatballhat Oct 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/.codecov.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/codecov.yml
@@ -0,0 +1,9 @@
comment: false
coverage:
status:
project:
default:
threshold: 5%
patch:
default:
threshold: 5%
115 changes: 45 additions & 70 deletions .github/workflows/cli.yml
@@ -1,5 +1,4 @@
name: Run Tests

on:
push:
branches:
Expand All @@ -12,87 +11,68 @@ on:
branches:
- main
- v3-dev-main

permissions:
contents: read
jobs:
test:
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:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Set PATH
run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"

- 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: vet
run: go run internal/build/build.go vet

- name: test with urfave_cli_no_docs tag
run: go run internal/build/build.go -tags urfave_cli_no_docs test

- name: test
run: go run internal/build/build.go test

- name: check-binary-size
run: go run internal/build/build.go check-binary-size

- name: check-binary-size with tags (informational only)
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'
uses: codecov/codecov-action@v2
- uses: actions/checkout@v3
- if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
run: make ensure-goimports
- if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
run: make lint
- run: make vet
- run: make test
env:
GFLAGS: -tags urfave_cli_no_docs
- run: make test
- run: make -C cmd/urfave-cli-genflags
- run: make check-binary-size
env:
GFLAGS: -tags urfave_cli_no_docs
- run: make check-binary-size
- run: make yamlfmt
- run: make diffcheck
- if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
run: make v2diff
- if: success() && matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

test-docs:
name: test-docs
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: Use Node.js 16
uses: actions/setup-node@v3
go-version: 1.19.x
- uses: actions/setup-node@v3
with:
node-version: '16'

- name: Set PATH
run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"

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

- name: Install Dependencies
run: |
mkdir -p "${GITHUB_WORKSPACE}/.local/bin"
curl -fsSL -o "${GITHUB_WORKSPACE}/.local/bin/gfmrun" "https://github.com/urfave/gfmrun/releases/download/v1.3.0/gfmrun-$(go env GOOS)-$(go env GOARCH)-v1.3.0"
chmod +x "${GITHUB_WORKSPACE}/.local/bin/gfmrun"

- name: gfmrun
run: go run internal/build/build.go gfmrun docs/v3/index.md

- name: diff check
run: |
git diff --exit-code
git diff --cached --exit-code

- uses: actions/checkout@v3
- run: make ensure-gfmrun
- run: make gfmrun
env:
FLAGS: --walk docs/v3/
- run: make diffcheck
publish:
permissions:
contents: write
# TODO: switch once v3 is released {{
# if: startswith(github.ref, 'refs/tags/')
if: 'false'
Expand All @@ -101,18 +81,13 @@ jobs:
needs: [test-docs]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup mkdocs
run: |
pip install -U pip
pip install -r mkdocs-requirements.txt
git remote rm origin
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/urfave/cli.git

- name: Publish Docs
run: |
mkdocs gh-deploy --force
- run: make ensure-mkdocs
env:
FLAGS: --upgrade-pip
- run: make set-mkdocs-remote
env:
MKDOCS_REMOTE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: make deploy-mkdocs
12 changes: 7 additions & 5 deletions .gitignore
@@ -1,10 +1,12 @@
*.coverprofile
*.exe
*.orig
vendor
.*envrc
.envrc
.idea
internal/*/built-example
coverage.txt
/.local/
/cmd/urfave-cli-genflags/urfave-cli-genflags
/site/

*.exe
coverage.txt
internal/*/built-example
vendor
22 changes: 4 additions & 18 deletions Makefile
Expand Up @@ -4,37 +4,23 @@
# are very important so that maintainers and contributors can focus their
# attention on files that are primarily Go.

GO_RUN_BUILD := go run internal/build/build.go

.PHONY: all
all: generate vet tag-test test check-binary-size tag-check-binary-size gfmrun v2diff
all: generate vet test check-binary-size gfmrun yamlfmt v2diff

# NOTE: this is a special catch-all rule to run any of the commands
# defined in internal/build/build.go with optional arguments passed
# via GFLAGS (global flags) and FLAGS (command-specific flags), e.g.:
#
# $ make test GFLAGS='--packages cli'
%:
go run internal/build/build.go $(GFLAGS) $* $(FLAGS)

.PHONY: tag-test
tag-test:
go run internal/build/build.go -tags urfave_cli_no_docs test

.PHONY: tag-check-binary-size
tag-check-binary-size:
go run internal/build/build.go -tags urfave_cli_no_docs check-binary-size

.PHONY: gfmrun
gfmrun:
go run internal/build/build.go gfmrun docs/v2/manual.md
$(GO_RUN_BUILD) $(GFLAGS) $* $(FLAGS)

.PHONY: docs
docs:
mkdocs build

.PHONY: docs-deps
docs-deps:
pip install -r mkdocs-requirements.txt

.PHONY: serve-docs
serve-docs:
mkdocs serve