From 78bad9b45637be48624206b06559073ab5a3811d Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 10:39:25 +0530 Subject: [PATCH 01/24] enable windows build --- .github/workflows/cli.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index d4f9cdb..66eb6b2 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -14,7 +14,7 @@ jobs: test: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] go: [1.11, 1.12, 1.13] name: ${{ matrix.os }} @ Go ${{ matrix.go }} runs-on: ${{ matrix.os }} @@ -51,6 +51,14 @@ jobs: chmod +x $GOPATH/bin/gfmrun npm install markdown-toc + - name: Install Dependencies (Windows) + if: matrix.os == 'windows-latest' + run: | + mkdir -p $GOPATH/bin + curl -s https://api.github.com/repos/urfave/gfmrun/releases/latest | grep gfmrun-windows-amd64 | grep download | cut -d '"' -f 4 | wget -O $GOPATH/bin/gfmrun -i - + chmod +x $GOPATH/bin/gfmrun + npm install markdown-toc + - name: Run Tests (v1) if: contains(github.base_ref, 'v1') run: | From fd01ea62f457b4cf7b18d4f7e61479915916e5c2 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 10:46:41 +0530 Subject: [PATCH 02/24] add win dependencies --- .github/workflows/cli.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 66eb6b2..4a10ff5 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -54,9 +54,10 @@ jobs: - name: Install Dependencies (Windows) if: matrix.os == 'windows-latest' run: | - mkdir -p $GOPATH/bin + md $GOPATH/bin + choco install curl + choco install wget curl -s https://api.github.com/repos/urfave/gfmrun/releases/latest | grep gfmrun-windows-amd64 | grep download | cut -d '"' -f 4 | wget -O $GOPATH/bin/gfmrun -i - - chmod +x $GOPATH/bin/gfmrun npm install markdown-toc - name: Run Tests (v1) From 1a3f36ddffa5f871bfb8791e45227e3bae8b218e Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 10:54:34 +0530 Subject: [PATCH 03/24] install gnu coreutils --- .github/workflows/cli.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 4a10ff5..97ed132 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -57,6 +57,7 @@ jobs: md $GOPATH/bin choco install curl choco install wget + choco install gnuwin32-coreutils.install curl -s https://api.github.com/repos/urfave/gfmrun/releases/latest | grep gfmrun-windows-amd64 | grep download | cut -d '"' -f 4 | wget -O $GOPATH/bin/gfmrun -i - npm install markdown-toc From 29f4ccff7b34e9a3911d5c18fcb856ad85ed72d4 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 11:18:57 +0530 Subject: [PATCH 04/24] fix cut delimiter error --- .github/workflows/cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 97ed132..55dac26 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -58,7 +58,7 @@ jobs: choco install curl choco install wget choco install gnuwin32-coreutils.install - curl -s https://api.github.com/repos/urfave/gfmrun/releases/latest | grep gfmrun-windows-amd64 | grep download | cut -d '"' -f 4 | wget -O $GOPATH/bin/gfmrun -i - + curl -s https://api.github.com/repos/urfave/gfmrun/releases/latest | grep gfmrun-windows-amd64 | grep download | cut -d "\"" -f 4 | wget -O $GOPATH/bin/gfmrun -i - npm install markdown-toc - name: Run Tests (v1) From 9f5fad19891df28012ce8d874f1e76d8020a7f98 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 11:36:03 +0530 Subject: [PATCH 05/24] pin to release --- .github/workflows/cli.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 55dac26..7ef0dbd 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -39,7 +39,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | mkdir -p $GOPATH/bin - curl -s https://api.github.com/repos/urfave/gfmrun/releases/latest | grep gfmrun-linux-amd64 | grep download | cut -d '"' -f 4 | wget -O $GOPATH/bin/gfmrun -i - + curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-linux-amd64-v1.2.14" chmod +x $GOPATH/bin/gfmrun npm install markdown-toc @@ -47,7 +47,7 @@ jobs: if: matrix.os == 'macos-latest' run: | mkdir -p $GOPATH/bin - curl -s https://api.github.com/repos/urfave/gfmrun/releases/latest | grep gfmrun-darwin-amd64 | grep download | cut -d '"' -f 4 | wget -O $GOPATH/bin/gfmrun -i - + curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-darwin-amd64-v1.2.14" chmod +x $GOPATH/bin/gfmrun npm install markdown-toc @@ -55,10 +55,7 @@ jobs: if: matrix.os == 'windows-latest' run: | md $GOPATH/bin - choco install curl - choco install wget - choco install gnuwin32-coreutils.install - curl -s https://api.github.com/repos/urfave/gfmrun/releases/latest | grep gfmrun-windows-amd64 | grep download | cut -d "\"" -f 4 | wget -O $GOPATH/bin/gfmrun -i - + curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" npm install markdown-toc - name: Run Tests (v1) From 55924039a1d1f73dcc580b5e1d88aa0dbd0077af Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 12:04:24 +0530 Subject: [PATCH 06/24] add support for windows --- build.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.go b/build.go index 325552c..6f17211 100644 --- a/build.go +++ b/build.go @@ -10,6 +10,7 @@ import ( "log" "os" "os/exec" + "runtime" "strings" "github.com/urfave/cli/v2" @@ -157,7 +158,11 @@ func GfmrunActionFunc(c *cli.Context) error { return err } - return runCmd("gfmrun", "-c", fmt.Sprint(counter), "-s", filename) + if runtime.GOOS == "windows" { + return runCmd("gfmrun.exe", "-c", fmt.Sprint(counter), "-s", filename) + } else { + return runCmd("gfmrun", "-c", fmt.Sprint(counter), "-s", filename) + } } func TocActionFunc(c *cli.Context) error { From 01ba4336a4c79a58962e801853e85637749d6247 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 12:16:15 +0530 Subject: [PATCH 07/24] fix windows build --- .github/workflows/cli.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 7ef0dbd..9d5d5d4 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -54,8 +54,8 @@ jobs: - name: Install Dependencies (Windows) if: matrix.os == 'windows-latest' run: | - md $GOPATH/bin - curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" + md $GOPATH\bin + curl -L -o $GOPATH\bin\gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" npm install markdown-toc - name: Run Tests (v1) From 67a8b288fd40693744a5e489cf867d232ba28b41 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 12:30:13 +0530 Subject: [PATCH 08/24] fix windows env --- .github/workflows/cli.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 9d5d5d4..060c813 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -54,8 +54,9 @@ jobs: - name: Install Dependencies (Windows) if: matrix.os == 'windows-latest' run: | - md $GOPATH\bin - curl -L -o $GOPATH\bin\gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" + set path=%path%;%GITHUB_WORKSPACE%\bin + md %GITHUB_WORKSPACE%\bin + curl -L -o %GITHUB_WORKSPACE%\bin\gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" npm install markdown-toc - name: Run Tests (v1) From 8dfefe854e680b3cfaf3d91d6d67b421ddd55a6d Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 12:51:15 +0530 Subject: [PATCH 09/24] env fixes --- .github/workflows/cli.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 060c813..6fd9932 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -26,8 +26,8 @@ jobs: - name: Set GOPATH and PATH run: | - echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)" - echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin" + echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)" + echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin" shell: bash - name: Checkout Code @@ -54,9 +54,7 @@ jobs: - name: Install Dependencies (Windows) if: matrix.os == 'windows-latest' run: | - set path=%path%;%GITHUB_WORKSPACE%\bin - md %GITHUB_WORKSPACE%\bin - curl -L -o %GITHUB_WORKSPACE%\bin\gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" + curl -L -o gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" npm install markdown-toc - name: Run Tests (v1) From 8bc13046c4f82b34d72c4501d6683d5dee6f176c Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 14:04:12 +0530 Subject: [PATCH 10/24] fix failing build --- .github/workflows/cli.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 6fd9932..775c4c2 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -57,16 +57,32 @@ jobs: curl -L -o gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" npm install markdown-toc - - name: Run Tests (v1) - if: contains(github.base_ref, 'v1') + - name: Run Tests (v1) (Linux/Mac) + if: contains(github.base_ref, 'v1') && matrix.os != 'windows-latest' run: | go run build.go vet go run build.go test go run build.go gfmrun docs/v1/manual.md go run build.go toc docs/v1/manual.md - - name: Run Tests (v2) - if: contains(github.base_ref, 'master') + - name: Run Tests (v1) (Windows) + if: contains(github.base_ref, 'v1') && matrix.os == 'windows-latest' + run: | + go run build.go vet + go run build.go test + go run build.go gfmrun docs\v1\manual.md + go run build.go toc docs\v1\manual.md + + - name: Run Tests (v2) (Linux/Mac) + if: contains(github.base_ref, 'master') && matrix.os != 'windows-latest' + run: | + go run build.go vet + go run build.go test + go run build.go gfmrun docs/v2/manual.md + go run build.go toc docs/v2/manual.md + + - name: Run Tests (v2) (Windows) + if: contains(github.base_ref, 'master') && matrix.os == 'windows-latest' run: | go run build.go vet go run build.go test From da1a889fd6f71396311cd5e1d1d02f80ebd29227 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 16:24:53 +0530 Subject: [PATCH 11/24] update the way env is set --- .github/workflows/cli.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 775c4c2..5106306 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -6,10 +6,6 @@ on: - master - v1 -env: - GO111MODULE: on - GOPROXY: https://proxy.golang.org - jobs: test: strategy: @@ -24,9 +20,11 @@ jobs: with: go-version: ${{ matrix.go }} - - name: Set GOPATH and PATH + - name: Set GOPATH, PATH and ENV run: | echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)" + echo "::set-env name=GO111MODULE::on" + echo "::set-env name=GOPROXY::https://proxy.golang.org,direct" echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin" shell: bash From fcdaa08dc8769979b8c1e9e8ee812060ff418069 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Fri, 6 Dec 2019 16:26:34 +0530 Subject: [PATCH 12/24] update goproxy to valid value --- .github/workflows/cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 5106306..5163246 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -24,7 +24,7 @@ jobs: run: | echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)" echo "::set-env name=GO111MODULE::on" - echo "::set-env name=GOPROXY::https://proxy.golang.org,direct" + echo "::set-env name=GOPROXY::https://proxy.golang.org" echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin" shell: bash From 646677ae0b360220a7ba4ce7c27c754824ecf429 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sat, 7 Dec 2019 12:34:48 +0530 Subject: [PATCH 13/24] optimise yml --- .github/workflows/cli.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 5163246..9de4461 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -33,19 +33,11 @@ jobs: with: ref: ${{ github.ref }} - - name: Install Dependencies (Linux) - if: matrix.os == 'ubuntu-latest' + - name: Install Dependencies (Linux / MacOS) + if: matrix.os != 'windows-latest' run: | mkdir -p $GOPATH/bin - curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-linux-amd64-v1.2.14" - chmod +x $GOPATH/bin/gfmrun - npm install markdown-toc - - - name: Install Dependencies (Mac) - if: matrix.os == 'macos-latest' - run: | - mkdir -p $GOPATH/bin - curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-darwin-amd64-v1.2.14" + curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-$(go env GOOS)-amd64-v1.2.14" chmod +x $GOPATH/bin/gfmrun npm install markdown-toc @@ -55,7 +47,7 @@ jobs: curl -L -o gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" npm install markdown-toc - - name: Run Tests (v1) (Linux/Mac) + - name: Run Tests (v1) (Linux / MacOS) if: contains(github.base_ref, 'v1') && matrix.os != 'windows-latest' run: | go run build.go vet @@ -71,7 +63,7 @@ jobs: go run build.go gfmrun docs\v1\manual.md go run build.go toc docs\v1\manual.md - - name: Run Tests (v2) (Linux/Mac) + - name: Run Tests (v2) (Linux / MacOS) if: contains(github.base_ref, 'master') && matrix.os != 'windows-latest' run: | go run build.go vet From 0ce33c37854fbca7a36df49bd4dca25ff6ca9124 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sun, 8 Dec 2019 13:52:50 +0530 Subject: [PATCH 14/24] handle windows line endings --- docs_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs_test.go b/docs_test.go index e52cf8b..cea34ae 100644 --- a/docs_test.go +++ b/docs_test.go @@ -1,6 +1,7 @@ package cli import ( + "bytes" "io/ioutil" "testing" ) @@ -73,6 +74,8 @@ func testApp() *App { func expectFileContent(t *testing.T, file, expected string) { data, err := ioutil.ReadFile(file) + // Ignore windows line endings + expected = string(bytes.ReplaceAll([]byte(expected), []byte("\r\n"), []byte("\n"))) expect(t, err, nil) expect(t, string(data), expected) } From 51e2b186d77eb74f3b189cd4642fb57280c3b90e Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sun, 8 Dec 2019 13:55:56 +0530 Subject: [PATCH 15/24] add support for go 1.11 --- docs_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs_test.go b/docs_test.go index cea34ae..3c15909 100644 --- a/docs_test.go +++ b/docs_test.go @@ -75,7 +75,8 @@ func testApp() *App { func expectFileContent(t *testing.T, file, expected string) { data, err := ioutil.ReadFile(file) // Ignore windows line endings - expected = string(bytes.ReplaceAll([]byte(expected), []byte("\r\n"), []byte("\n"))) + // TODO: Replace with bytes.ReplaceAll when support for Go 1.11 is dropped + expected = string(bytes.Replace([]byte(expected), []byte("\r\n"), []byte("\n"), -1)) expect(t, err, nil) expect(t, string(data), expected) } From 9c44406c8726effa0fdcacdb01b50185001b77bb Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 25 Dec 2019 09:10:48 -0800 Subject: [PATCH 16/24] refactor --- .github/workflows/cli.yml | 78 +++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 350d8fd..ecb90dc 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -11,6 +11,7 @@ on: - v1 jobs: + test: strategy: matrix: @@ -37,52 +38,59 @@ jobs: with: ref: ${{ github.ref }} - - name: Install Dependencies (Linux / MacOS) - if: matrix.os != 'windows-latest' - run: | - mkdir -p $GOPATH/bin - curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-$(go env GOOS)-amd64-v1.2.14" - chmod +x $GOPATH/bin/gfmrun - npm install markdown-toc - - - name: Install Dependencies (Windows) - if: matrix.os == 'windows-latest' - run: | - curl -L -o gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe" - npm install markdown-toc - - name: Run Tests run: | go run build.go vet go run build.go test - - name: Run Tests (v1) (Linux / MacOS) - if: contains(github.base_ref, 'v1') && matrix.os != 'windows-latest' + - name: Upload coverage to Codecov + if: success() && matrix.go == 1.13 && matrix.os == 'ubuntu-latest' + uses: codecov/codecov-action@v1 + with: + token: 0a8cc73b-bb7c-480b-8626-38a461643761 + fail_ci_if_error: true + + test-docs: + strategy: + matrix: + os: [ubuntu-latest] + go: [1.13] + name: test-docs + runs-on: ${{ matrix.os }} + steps: + - name: Set up Go ${{ matrix.go }} + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go }} + + - name: Set GOPATH, PATH and ENV run: | - go run build.go gfmrun docs/v1/manual.md - go run build.go toc docs/v1/manual.md + echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)" + echo "::set-env name=GO111MODULE::on" + echo "::set-env name=GOPROXY::https://proxy.golang.org" + echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin" + shell: bash - - name: Run Tests (v1) (Windows) - if: contains(github.base_ref, 'v1') && matrix.os == 'windows-latest' + - name: Checkout Code + uses: actions/checkout@v1 + with: + ref: ${{ github.ref }} + + - name: Install Dependencies run: | - go run build.go gfmrun docs\v1\manual.md - go run build.go toc docs\v1\manual.md + mkdir -p $GOPATH/bin + curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-$(go env GOOS)-amd64-v1.2.14" + chmod +x $GOPATH/bin/gfmrun + npm install markdown-toc - - name: Run Tests (v2) (Linux / MacOS) - if: contains(github.base_ref, 'master') && matrix.os != 'windows-latest' + - name: Run Tests (v1) + if: contains(github.base_ref, 'v1') run: | - go run build.go gfmrun docs/v2/manual.md - go run build.go toc docs/v2/manual.md + go run build.go gfmrun docs/v1/manual.md + go run build.go toc docs/v1/manual.md - - name: Run Tests (v2) (Windows) - if: contains(github.base_ref, 'master') && matrix.os == 'windows-latest' + - name: Run Tests (v2) + if: contains(github.base_ref, 'master') run: | go run build.go gfmrun docs/v2/manual.md go run build.go toc docs/v2/manual.md - - - name: Upload coverage to Codecov - if: success() && matrix.go == 1.13 && matrix.os == 'ubuntu-latest' - uses: codecov/codecov-action@v1 - with: - token: 0a8cc73b-bb7c-480b-8626-38a461643761 - fail_ci_if_error: true From 8ac2777fb3b49e4768770e40b7faeb4b675103ec Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 25 Dec 2019 09:11:42 -0800 Subject: [PATCH 17/24] revert some stuff --- build.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/build.go b/build.go index 6f17211..325552c 100644 --- a/build.go +++ b/build.go @@ -10,7 +10,6 @@ import ( "log" "os" "os/exec" - "runtime" "strings" "github.com/urfave/cli/v2" @@ -158,11 +157,7 @@ func GfmrunActionFunc(c *cli.Context) error { return err } - if runtime.GOOS == "windows" { - return runCmd("gfmrun.exe", "-c", fmt.Sprint(counter), "-s", filename) - } else { - return runCmd("gfmrun", "-c", fmt.Sprint(counter), "-s", filename) - } + return runCmd("gfmrun", "-c", fmt.Sprint(counter), "-s", filename) } func TocActionFunc(c *cli.Context) error { From 56dac7449a429596780a361b560a863ab4bab5ec Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 25 Dec 2019 09:11:53 -0800 Subject: [PATCH 18/24] remove appveyor --- appveyor.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index f1cae90..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: "{build}" - -os: Windows Server 2016 - -image: Visual Studio 2017 - -clone_folder: c:\gopath\src\github.com\urfave\cli - -cache: - - node_modules - -environment: - GOPATH: C:\gopath - GOVERSION: 1.11.x - GO111MODULE: on - GOPROXY: https://proxy.golang.org - -install: - - set PATH=%GOPATH%\bin;C:\go\bin;%PATH% - - go version - - go env - - go get github.com/urfave/gfmrun/cmd/gfmrun - - go mod tidy - -build_script: - - go run build.go vet - - go run build.go test - - go run build.go gfmrun docs/v1/manual.md From 813b4dd1d0fa22b377b9e0e71c1193b8ed61e04d Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 25 Dec 2019 09:18:50 -0800 Subject: [PATCH 19/24] test changing line endings --- testdata/expected-doc-full.man | 166 +++++++++++++-------------- testdata/expected-doc-full.md | 126 ++++++++++---------- testdata/expected-doc-no-authors.md | 122 ++++++++++---------- testdata/expected-doc-no-commands.md | 74 ++++++------ testdata/expected-doc-no-flags.md | 96 ++++++++-------- testdata/expected-fish-full.fish | 56 ++++----- 6 files changed, 320 insertions(+), 320 deletions(-) diff --git a/testdata/expected-doc-full.man b/testdata/expected-doc-full.man index f28f4c7..a4fd448 100644 --- a/testdata/expected-doc-full.man +++ b/testdata/expected-doc-full.man @@ -1,83 +1,83 @@ -.nh -.TH greet(8) - -.SH Harrison harrison@lolwut.com -\[la]mailto:harrison@lolwut.com\[ra] -Oliver Allen oliver@toyshop.com -\[la]mailto:oliver@toyshop.com\[ra] - -.SH NAME -.PP -greet \- Some app - - -.SH SYNOPSIS -.PP -greet - -.PP -.RS - -.nf -[\-\-another\-flag|\-b] -[\-\-flag|\-\-fl|\-f]=[value] -[\-\-socket|\-s]=[value] - -.fi -.RE - - -.SH DESCRIPTION -.PP -app [first\_arg] [second\_arg] - -.PP -\fBUsage\fP: - -.PP -.RS - -.nf -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] - -.fi -.RE - - -.SH GLOBAL OPTIONS -.PP -\fB\-\-another\-flag, \-b\fP: another usage text - -.PP -\fB\-\-flag, \-\-fl, \-f\fP="": - -.PP -\fB\-\-socket, \-s\fP="": some 'usage' text (default: value) - - -.SH COMMANDS -.SH config, c -.PP -another usage test - -.PP -\fB\-\-another\-flag, \-b\fP: another usage text - -.PP -\fB\-\-flag, \-\-fl, \-f\fP="": - -.SS sub\-config, s, ss -.PP -another usage test - -.PP -\fB\-\-sub\-command\-flag, \-s\fP: some usage text - -.PP -\fB\-\-sub\-flag, \-\-sub\-fl, \-s\fP="": - -.SH info, i, in -.PP -retrieve generic information - -.SH some\-command \ No newline at end of file +.nh +.TH greet(8) + +.SH Harrison harrison@lolwut.com +\[la]mailto:harrison@lolwut.com\[ra] +Oliver Allen oliver@toyshop.com +\[la]mailto:oliver@toyshop.com\[ra] + +.SH NAME +.PP +greet \- Some app + + +.SH SYNOPSIS +.PP +greet + +.PP +.RS + +.nf +[\-\-another\-flag|\-b] +[\-\-flag|\-\-fl|\-f]=[value] +[\-\-socket|\-s]=[value] + +.fi +.RE + + +.SH DESCRIPTION +.PP +app [first\_arg] [second\_arg] + +.PP +\fBUsage\fP: + +.PP +.RS + +.nf +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] + +.fi +.RE + + +.SH GLOBAL OPTIONS +.PP +\fB\-\-another\-flag, \-b\fP: another usage text + +.PP +\fB\-\-flag, \-\-fl, \-f\fP="": + +.PP +\fB\-\-socket, \-s\fP="": some 'usage' text (default: value) + + +.SH COMMANDS +.SH config, c +.PP +another usage test + +.PP +\fB\-\-another\-flag, \-b\fP: another usage text + +.PP +\fB\-\-flag, \-\-fl, \-f\fP="": + +.SS sub\-config, s, ss +.PP +another usage test + +.PP +\fB\-\-sub\-command\-flag, \-s\fP: some usage text + +.PP +\fB\-\-sub\-flag, \-\-sub\-fl, \-s\fP="": + +.SH info, i, in +.PP +retrieve generic information + +.SH some\-command diff --git a/testdata/expected-doc-full.md b/testdata/expected-doc-full.md index 5bfb01e..044ac57 100644 --- a/testdata/expected-doc-full.md +++ b/testdata/expected-doc-full.md @@ -1,63 +1,63 @@ -% greet(8) - -% Harrison -% Oliver Allen - -# NAME - -greet - Some app - -# SYNOPSIS - -greet - -``` -[--another-flag|-b] -[--flag|--fl|-f]=[value] -[--socket|-s]=[value] -``` - -# DESCRIPTION - -app [first_arg] [second_arg] - -**Usage**: - -``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -``` - -# GLOBAL OPTIONS - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -**--socket, -s**="": some 'usage' text (default: value) - - -# COMMANDS - -## config, c - -another usage test - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -### sub-config, s, ss - -another usage test - -**--sub-command-flag, -s**: some usage text - -**--sub-flag, --sub-fl, -s**="": - -## info, i, in - -retrieve generic information - -## some-command - - +% greet(8) + +% Harrison +% Oliver Allen + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +``` +[--another-flag|-b] +[--flag|--fl|-f]=[value] +[--socket|-s]=[value] +``` + +# DESCRIPTION + +app [first_arg] [second_arg] + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# GLOBAL OPTIONS + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +**--socket, -s**="": some 'usage' text (default: value) + + +# COMMANDS + +## config, c + +another usage test + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-config, s, ss + +another usage test + +**--sub-command-flag, -s**: some usage text + +**--sub-flag, --sub-fl, -s**="": + +## info, i, in + +retrieve generic information + +## some-command + + diff --git a/testdata/expected-doc-no-authors.md b/testdata/expected-doc-no-authors.md index a49481a..f471062 100644 --- a/testdata/expected-doc-no-authors.md +++ b/testdata/expected-doc-no-authors.md @@ -1,61 +1,61 @@ -% greet(8) - - -# NAME - -greet - Some app - -# SYNOPSIS - -greet - -``` -[--another-flag|-b] -[--flag|--fl|-f]=[value] -[--socket|-s]=[value] -``` - -# DESCRIPTION - -app [first_arg] [second_arg] - -**Usage**: - -``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -``` - -# GLOBAL OPTIONS - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -**--socket, -s**="": some 'usage' text (default: value) - - -# COMMANDS - -## config, c - -another usage test - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -### sub-config, s, ss - -another usage test - -**--sub-command-flag, -s**: some usage text - -**--sub-flag, --sub-fl, -s**="": - -## info, i, in - -retrieve generic information - -## some-command - - +% greet(8) + + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +``` +[--another-flag|-b] +[--flag|--fl|-f]=[value] +[--socket|-s]=[value] +``` + +# DESCRIPTION + +app [first_arg] [second_arg] + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# GLOBAL OPTIONS + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +**--socket, -s**="": some 'usage' text (default: value) + + +# COMMANDS + +## config, c + +another usage test + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-config, s, ss + +another usage test + +**--sub-command-flag, -s**: some usage text + +**--sub-flag, --sub-fl, -s**="": + +## info, i, in + +retrieve generic information + +## some-command + + diff --git a/testdata/expected-doc-no-commands.md b/testdata/expected-doc-no-commands.md index f82f642..3307e99 100644 --- a/testdata/expected-doc-no-commands.md +++ b/testdata/expected-doc-no-commands.md @@ -1,37 +1,37 @@ -% greet(8) - -% Harrison -% Oliver Allen - -# NAME - -greet - Some app - -# SYNOPSIS - -greet - -``` -[--another-flag|-b] -[--flag|--fl|-f]=[value] -[--socket|-s]=[value] -``` - -# DESCRIPTION - -app [first_arg] [second_arg] - -**Usage**: - -``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -``` - -# GLOBAL OPTIONS - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -**--socket, -s**="": some 'usage' text (default: value) - +% greet(8) + +% Harrison +% Oliver Allen + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +``` +[--another-flag|-b] +[--flag|--fl|-f]=[value] +[--socket|-s]=[value] +``` + +# DESCRIPTION + +app [first_arg] [second_arg] + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# GLOBAL OPTIONS + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +**--socket, -s**="": some 'usage' text (default: value) + diff --git a/testdata/expected-doc-no-flags.md b/testdata/expected-doc-no-flags.md index c32a9fc..dbf8793 100644 --- a/testdata/expected-doc-no-flags.md +++ b/testdata/expected-doc-no-flags.md @@ -1,48 +1,48 @@ -% greet(8) - -% Harrison -% Oliver Allen - -# NAME - -greet - Some app - -# SYNOPSIS - -greet - -# DESCRIPTION - -app [first_arg] [second_arg] - -**Usage**: - -``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -``` - -# COMMANDS - -## config, c - -another usage test - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -### sub-config, s, ss - -another usage test - -**--sub-command-flag, -s**: some usage text - -**--sub-flag, --sub-fl, -s**="": - -## info, i, in - -retrieve generic information - -## some-command - - +% greet(8) + +% Harrison +% Oliver Allen + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +# DESCRIPTION + +app [first_arg] [second_arg] + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# COMMANDS + +## config, c + +another usage test + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-config, s, ss + +another usage test + +**--sub-command-flag, -s**: some usage text + +**--sub-flag, --sub-fl, -s**="": + +## info, i, in + +retrieve generic information + +## some-command + + diff --git a/testdata/expected-fish-full.fish b/testdata/expected-fish-full.fish index b18d51e..350bd67 100644 --- a/testdata/expected-fish-full.fish +++ b/testdata/expected-fish-full.fish @@ -1,28 +1,28 @@ -# greet fish shell completion - -function __fish_greet_no_subcommand --description 'Test if there has been any subcommand yet' - for i in (commandline -opc) - if contains -- $i config c sub-config s ss info i in some-command - return 1 - end - end - return 0 -end - -complete -c greet -n '__fish_greet_no_subcommand' -l socket -s s -r -d 'some \'usage\' text' -complete -c greet -n '__fish_greet_no_subcommand' -f -l flag -s fl -s f -r -complete -c greet -n '__fish_greet_no_subcommand' -f -l another-flag -s b -d 'another usage text' -complete -c greet -n '__fish_greet_no_subcommand' -f -l help -s h -d 'show help' -complete -c greet -n '__fish_greet_no_subcommand' -f -l version -s v -d 'print the version' -complete -c greet -n '__fish_seen_subcommand_from config c' -f -l help -s h -d 'show help' -complete -r -c greet -n '__fish_greet_no_subcommand' -a 'config c' -d 'another usage test' -complete -c greet -n '__fish_seen_subcommand_from config c' -l flag -s fl -s f -r -complete -c greet -n '__fish_seen_subcommand_from config c' -f -l another-flag -s b -d 'another usage text' -complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l help -s h -d 'show help' -complete -r -c greet -n '__fish_seen_subcommand_from config c' -a 'sub-config s ss' -d 'another usage test' -complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-flag -s sub-fl -s s -r -complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-command-flag -s s -d 'some usage text' -complete -c greet -n '__fish_seen_subcommand_from info i in' -f -l help -s h -d 'show help' -complete -r -c greet -n '__fish_greet_no_subcommand' -a 'info i in' -d 'retrieve generic information' -complete -c greet -n '__fish_seen_subcommand_from some-command' -f -l help -s h -d 'show help' -complete -r -c greet -n '__fish_greet_no_subcommand' -a 'some-command' +# greet fish shell completion + +function __fish_greet_no_subcommand --description 'Test if there has been any subcommand yet' + for i in (commandline -opc) + if contains -- $i config c sub-config s ss info i in some-command + return 1 + end + end + return 0 +end + +complete -c greet -n '__fish_greet_no_subcommand' -l socket -s s -r -d 'some \'usage\' text' +complete -c greet -n '__fish_greet_no_subcommand' -f -l flag -s fl -s f -r +complete -c greet -n '__fish_greet_no_subcommand' -f -l another-flag -s b -d 'another usage text' +complete -c greet -n '__fish_greet_no_subcommand' -f -l help -s h -d 'show help' +complete -c greet -n '__fish_greet_no_subcommand' -f -l version -s v -d 'print the version' +complete -c greet -n '__fish_seen_subcommand_from config c' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_greet_no_subcommand' -a 'config c' -d 'another usage test' +complete -c greet -n '__fish_seen_subcommand_from config c' -l flag -s fl -s f -r +complete -c greet -n '__fish_seen_subcommand_from config c' -f -l another-flag -s b -d 'another usage text' +complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_seen_subcommand_from config c' -a 'sub-config s ss' -d 'another usage test' +complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-flag -s sub-fl -s s -r +complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-command-flag -s s -d 'some usage text' +complete -c greet -n '__fish_seen_subcommand_from info i in' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_greet_no_subcommand' -a 'info i in' -d 'retrieve generic information' +complete -c greet -n '__fish_seen_subcommand_from some-command' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_greet_no_subcommand' -a 'some-command' From 9c3c74b4919c213bfb76025d4ed26ce3a2c8caf6 Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 25 Dec 2019 09:20:44 -0800 Subject: [PATCH 20/24] Revert "test changing line endings" This reverts commit 813b4dd1d0fa22b377b9e0e71c1193b8ed61e04d. --- testdata/expected-doc-full.man | 166 +++++++++++++-------------- testdata/expected-doc-full.md | 126 ++++++++++---------- testdata/expected-doc-no-authors.md | 122 ++++++++++---------- testdata/expected-doc-no-commands.md | 74 ++++++------ testdata/expected-doc-no-flags.md | 96 ++++++++-------- testdata/expected-fish-full.fish | 56 ++++----- 6 files changed, 320 insertions(+), 320 deletions(-) diff --git a/testdata/expected-doc-full.man b/testdata/expected-doc-full.man index a4fd448..f28f4c7 100644 --- a/testdata/expected-doc-full.man +++ b/testdata/expected-doc-full.man @@ -1,83 +1,83 @@ -.nh -.TH greet(8) - -.SH Harrison harrison@lolwut.com -\[la]mailto:harrison@lolwut.com\[ra] -Oliver Allen oliver@toyshop.com -\[la]mailto:oliver@toyshop.com\[ra] - -.SH NAME -.PP -greet \- Some app - - -.SH SYNOPSIS -.PP -greet - -.PP -.RS - -.nf -[\-\-another\-flag|\-b] -[\-\-flag|\-\-fl|\-f]=[value] -[\-\-socket|\-s]=[value] - -.fi -.RE - - -.SH DESCRIPTION -.PP -app [first\_arg] [second\_arg] - -.PP -\fBUsage\fP: - -.PP -.RS - -.nf -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] - -.fi -.RE - - -.SH GLOBAL OPTIONS -.PP -\fB\-\-another\-flag, \-b\fP: another usage text - -.PP -\fB\-\-flag, \-\-fl, \-f\fP="": - -.PP -\fB\-\-socket, \-s\fP="": some 'usage' text (default: value) - - -.SH COMMANDS -.SH config, c -.PP -another usage test - -.PP -\fB\-\-another\-flag, \-b\fP: another usage text - -.PP -\fB\-\-flag, \-\-fl, \-f\fP="": - -.SS sub\-config, s, ss -.PP -another usage test - -.PP -\fB\-\-sub\-command\-flag, \-s\fP: some usage text - -.PP -\fB\-\-sub\-flag, \-\-sub\-fl, \-s\fP="": - -.SH info, i, in -.PP -retrieve generic information - -.SH some\-command +.nh +.TH greet(8) + +.SH Harrison harrison@lolwut.com +\[la]mailto:harrison@lolwut.com\[ra] +Oliver Allen oliver@toyshop.com +\[la]mailto:oliver@toyshop.com\[ra] + +.SH NAME +.PP +greet \- Some app + + +.SH SYNOPSIS +.PP +greet + +.PP +.RS + +.nf +[\-\-another\-flag|\-b] +[\-\-flag|\-\-fl|\-f]=[value] +[\-\-socket|\-s]=[value] + +.fi +.RE + + +.SH DESCRIPTION +.PP +app [first\_arg] [second\_arg] + +.PP +\fBUsage\fP: + +.PP +.RS + +.nf +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] + +.fi +.RE + + +.SH GLOBAL OPTIONS +.PP +\fB\-\-another\-flag, \-b\fP: another usage text + +.PP +\fB\-\-flag, \-\-fl, \-f\fP="": + +.PP +\fB\-\-socket, \-s\fP="": some 'usage' text (default: value) + + +.SH COMMANDS +.SH config, c +.PP +another usage test + +.PP +\fB\-\-another\-flag, \-b\fP: another usage text + +.PP +\fB\-\-flag, \-\-fl, \-f\fP="": + +.SS sub\-config, s, ss +.PP +another usage test + +.PP +\fB\-\-sub\-command\-flag, \-s\fP: some usage text + +.PP +\fB\-\-sub\-flag, \-\-sub\-fl, \-s\fP="": + +.SH info, i, in +.PP +retrieve generic information + +.SH some\-command \ No newline at end of file diff --git a/testdata/expected-doc-full.md b/testdata/expected-doc-full.md index 044ac57..5bfb01e 100644 --- a/testdata/expected-doc-full.md +++ b/testdata/expected-doc-full.md @@ -1,63 +1,63 @@ -% greet(8) - -% Harrison -% Oliver Allen - -# NAME - -greet - Some app - -# SYNOPSIS - -greet - -``` -[--another-flag|-b] -[--flag|--fl|-f]=[value] -[--socket|-s]=[value] -``` - -# DESCRIPTION - -app [first_arg] [second_arg] - -**Usage**: - -``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -``` - -# GLOBAL OPTIONS - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -**--socket, -s**="": some 'usage' text (default: value) - - -# COMMANDS - -## config, c - -another usage test - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -### sub-config, s, ss - -another usage test - -**--sub-command-flag, -s**: some usage text - -**--sub-flag, --sub-fl, -s**="": - -## info, i, in - -retrieve generic information - -## some-command - - +% greet(8) + +% Harrison +% Oliver Allen + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +``` +[--another-flag|-b] +[--flag|--fl|-f]=[value] +[--socket|-s]=[value] +``` + +# DESCRIPTION + +app [first_arg] [second_arg] + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# GLOBAL OPTIONS + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +**--socket, -s**="": some 'usage' text (default: value) + + +# COMMANDS + +## config, c + +another usage test + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-config, s, ss + +another usage test + +**--sub-command-flag, -s**: some usage text + +**--sub-flag, --sub-fl, -s**="": + +## info, i, in + +retrieve generic information + +## some-command + + diff --git a/testdata/expected-doc-no-authors.md b/testdata/expected-doc-no-authors.md index f471062..a49481a 100644 --- a/testdata/expected-doc-no-authors.md +++ b/testdata/expected-doc-no-authors.md @@ -1,61 +1,61 @@ -% greet(8) - - -# NAME - -greet - Some app - -# SYNOPSIS - -greet - -``` -[--another-flag|-b] -[--flag|--fl|-f]=[value] -[--socket|-s]=[value] -``` - -# DESCRIPTION - -app [first_arg] [second_arg] - -**Usage**: - -``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -``` - -# GLOBAL OPTIONS - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -**--socket, -s**="": some 'usage' text (default: value) - - -# COMMANDS - -## config, c - -another usage test - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -### sub-config, s, ss - -another usage test - -**--sub-command-flag, -s**: some usage text - -**--sub-flag, --sub-fl, -s**="": - -## info, i, in - -retrieve generic information - -## some-command - - +% greet(8) + + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +``` +[--another-flag|-b] +[--flag|--fl|-f]=[value] +[--socket|-s]=[value] +``` + +# DESCRIPTION + +app [first_arg] [second_arg] + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# GLOBAL OPTIONS + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +**--socket, -s**="": some 'usage' text (default: value) + + +# COMMANDS + +## config, c + +another usage test + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-config, s, ss + +another usage test + +**--sub-command-flag, -s**: some usage text + +**--sub-flag, --sub-fl, -s**="": + +## info, i, in + +retrieve generic information + +## some-command + + diff --git a/testdata/expected-doc-no-commands.md b/testdata/expected-doc-no-commands.md index 3307e99..f82f642 100644 --- a/testdata/expected-doc-no-commands.md +++ b/testdata/expected-doc-no-commands.md @@ -1,37 +1,37 @@ -% greet(8) - -% Harrison -% Oliver Allen - -# NAME - -greet - Some app - -# SYNOPSIS - -greet - -``` -[--another-flag|-b] -[--flag|--fl|-f]=[value] -[--socket|-s]=[value] -``` - -# DESCRIPTION - -app [first_arg] [second_arg] - -**Usage**: - -``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -``` - -# GLOBAL OPTIONS - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -**--socket, -s**="": some 'usage' text (default: value) - +% greet(8) + +% Harrison +% Oliver Allen + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +``` +[--another-flag|-b] +[--flag|--fl|-f]=[value] +[--socket|-s]=[value] +``` + +# DESCRIPTION + +app [first_arg] [second_arg] + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# GLOBAL OPTIONS + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +**--socket, -s**="": some 'usage' text (default: value) + diff --git a/testdata/expected-doc-no-flags.md b/testdata/expected-doc-no-flags.md index dbf8793..c32a9fc 100644 --- a/testdata/expected-doc-no-flags.md +++ b/testdata/expected-doc-no-flags.md @@ -1,48 +1,48 @@ -% greet(8) - -% Harrison -% Oliver Allen - -# NAME - -greet - Some app - -# SYNOPSIS - -greet - -# DESCRIPTION - -app [first_arg] [second_arg] - -**Usage**: - -``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -``` - -# COMMANDS - -## config, c - -another usage test - -**--another-flag, -b**: another usage text - -**--flag, --fl, -f**="": - -### sub-config, s, ss - -another usage test - -**--sub-command-flag, -s**: some usage text - -**--sub-flag, --sub-fl, -s**="": - -## info, i, in - -retrieve generic information - -## some-command - - +% greet(8) + +% Harrison +% Oliver Allen + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +# DESCRIPTION + +app [first_arg] [second_arg] + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# COMMANDS + +## config, c + +another usage test + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-config, s, ss + +another usage test + +**--sub-command-flag, -s**: some usage text + +**--sub-flag, --sub-fl, -s**="": + +## info, i, in + +retrieve generic information + +## some-command + + diff --git a/testdata/expected-fish-full.fish b/testdata/expected-fish-full.fish index 350bd67..b18d51e 100644 --- a/testdata/expected-fish-full.fish +++ b/testdata/expected-fish-full.fish @@ -1,28 +1,28 @@ -# greet fish shell completion - -function __fish_greet_no_subcommand --description 'Test if there has been any subcommand yet' - for i in (commandline -opc) - if contains -- $i config c sub-config s ss info i in some-command - return 1 - end - end - return 0 -end - -complete -c greet -n '__fish_greet_no_subcommand' -l socket -s s -r -d 'some \'usage\' text' -complete -c greet -n '__fish_greet_no_subcommand' -f -l flag -s fl -s f -r -complete -c greet -n '__fish_greet_no_subcommand' -f -l another-flag -s b -d 'another usage text' -complete -c greet -n '__fish_greet_no_subcommand' -f -l help -s h -d 'show help' -complete -c greet -n '__fish_greet_no_subcommand' -f -l version -s v -d 'print the version' -complete -c greet -n '__fish_seen_subcommand_from config c' -f -l help -s h -d 'show help' -complete -r -c greet -n '__fish_greet_no_subcommand' -a 'config c' -d 'another usage test' -complete -c greet -n '__fish_seen_subcommand_from config c' -l flag -s fl -s f -r -complete -c greet -n '__fish_seen_subcommand_from config c' -f -l another-flag -s b -d 'another usage text' -complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l help -s h -d 'show help' -complete -r -c greet -n '__fish_seen_subcommand_from config c' -a 'sub-config s ss' -d 'another usage test' -complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-flag -s sub-fl -s s -r -complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-command-flag -s s -d 'some usage text' -complete -c greet -n '__fish_seen_subcommand_from info i in' -f -l help -s h -d 'show help' -complete -r -c greet -n '__fish_greet_no_subcommand' -a 'info i in' -d 'retrieve generic information' -complete -c greet -n '__fish_seen_subcommand_from some-command' -f -l help -s h -d 'show help' -complete -r -c greet -n '__fish_greet_no_subcommand' -a 'some-command' +# greet fish shell completion + +function __fish_greet_no_subcommand --description 'Test if there has been any subcommand yet' + for i in (commandline -opc) + if contains -- $i config c sub-config s ss info i in some-command + return 1 + end + end + return 0 +end + +complete -c greet -n '__fish_greet_no_subcommand' -l socket -s s -r -d 'some \'usage\' text' +complete -c greet -n '__fish_greet_no_subcommand' -f -l flag -s fl -s f -r +complete -c greet -n '__fish_greet_no_subcommand' -f -l another-flag -s b -d 'another usage text' +complete -c greet -n '__fish_greet_no_subcommand' -f -l help -s h -d 'show help' +complete -c greet -n '__fish_greet_no_subcommand' -f -l version -s v -d 'print the version' +complete -c greet -n '__fish_seen_subcommand_from config c' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_greet_no_subcommand' -a 'config c' -d 'another usage test' +complete -c greet -n '__fish_seen_subcommand_from config c' -l flag -s fl -s f -r +complete -c greet -n '__fish_seen_subcommand_from config c' -f -l another-flag -s b -d 'another usage text' +complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_seen_subcommand_from config c' -a 'sub-config s ss' -d 'another usage test' +complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-flag -s sub-fl -s s -r +complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-command-flag -s s -d 'some usage text' +complete -c greet -n '__fish_seen_subcommand_from info i in' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_greet_no_subcommand' -a 'info i in' -d 'retrieve generic information' +complete -c greet -n '__fish_seen_subcommand_from some-command' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_greet_no_subcommand' -a 'some-command' From 300b9985aa4bd97c95c6dd97cfdc0f0a109417f6 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Mon, 13 Jan 2020 11:15:07 +0530 Subject: [PATCH 21/24] fix github-actions for windows --- docs_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs_test.go b/docs_test.go index 90240e7..232e24e 100644 --- a/docs_test.go +++ b/docs_test.go @@ -80,7 +80,7 @@ func expectFileContent(t *testing.T, file, expected string) { data, err := ioutil.ReadFile(file) // Ignore windows line endings // TODO: Replace with bytes.ReplaceAll when support for Go 1.11 is dropped - expected = string(bytes.Replace([]byte(expected), []byte("\r\n"), []byte("\n"), -1)) + data = bytes.Replace(data, []byte("\r\n"), []byte("\n"), -1) expect(t, err, nil) expect(t, string(data), expected) } From e02ef3d3c089df16b61ea0c99d11d3718d6afa08 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Mon, 13 Jan 2020 11:22:47 +0530 Subject: [PATCH 22/24] fix path for github actions --- altsrc/flag_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/altsrc/flag_test.go b/altsrc/flag_test.go index 80d20ee..bd622d6 100644 --- a/altsrc/flag_test.go +++ b/altsrc/flag_test.go @@ -189,7 +189,7 @@ func TestPathApplyInputSourceMethodSet(t *testing.T) { expected := "/path/to/source/hello" if runtime.GOOS == "windows" { - expected = `C:\path\to\source\hello` + expected = `D:\path\to\source\hello` } expect(t, expected, c.String("test")) } From daf1f71152e309e2dc541807278982b623d6e6a5 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Mon, 13 Jan 2020 22:11:38 +0530 Subject: [PATCH 23/24] Update cli.yml fix syntax error --- .github/workflows/cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 0d9f6b9..0582acf 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -68,7 +68,7 @@ jobs: with: node-version: 12.x - - name: - name: Set GOPATH, PATH and ENV + - name: Set GOPATH, PATH and ENV run: | echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)" echo "::set-env name=GO111MODULE::on" From 275ed591d30d5a217cc42bfa016e859104b2c95d Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Tue, 14 Jan 2020 11:43:41 +0530 Subject: [PATCH 24/24] Update cli.yml simplify test-docs workflow --- .github/workflows/cli.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 0582acf..a8ee5bb 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -51,17 +51,13 @@ jobs: fail_ci_if_error: true test-docs: - strategy: - matrix: - os: [ubuntu-latest] - go: [1.13] name: test-docs - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - - name: Set up Go ${{ matrix.go }} + - name: Set up Go 1.13 uses: actions/setup-go@v1 with: - go-version: ${{ matrix.go }} + go-version: 1.13 - name: Use Node.js 12.x uses: actions/setup-node@v1