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

Version 1.2.6 #118

Merged
merged 114 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
73230fa
Bump github.com/essentialkaos/ek/v12 from 12.60.0 to 12.60.1
dependabot[bot] Mar 2, 2023
7d0af0b
Merge pull request #61 from essentialkaos/dependabot/go_modules/devel…
andyone Mar 2, 2023
bb69b15
Bump github.com/essentialkaos/ek/v12 from 12.60.1 to 12.61.0
dependabot[bot] Mar 9, 2023
a7df6cc
Merge pull request #62 from essentialkaos/dependabot/go_modules/devel…
andyone Mar 9, 2023
e68ea52
Bump github.com/essentialkaos/ek/v12 from 12.61.0 to 12.62.0
dependabot[bot] Mar 10, 2023
56e9842
Merge pull request #63 from essentialkaos/dependabot/go_modules/devel…
andyone Mar 10, 2023
ddd319c
Bump github.com/essentialkaos/ek/v12 from 12.62.0 to 12.63.0
dependabot[bot] Mar 16, 2023
3c2b6b2
Bump actions/setup-go from 3 to 4
dependabot[bot] Mar 16, 2023
60d98cd
Merge pull request #65 from essentialkaos/dependabot/github_actions/d…
andyone Mar 16, 2023
60de409
Merge pull request #64 from essentialkaos/dependabot/go_modules/devel…
andyone Mar 16, 2023
1badb54
Bump github.com/essentialkaos/ek/v12 from 12.63.0 to 12.64.0
dependabot[bot] Apr 3, 2023
7b40c9a
Merge pull request #66 from essentialkaos/dependabot/go_modules/devel…
andyone Apr 3, 2023
77dc61b
Code refactoring
andyone Apr 18, 2023
0781b2e
Fix typos
andyone Apr 18, 2023
a547c77
Improve CI workflow
andyone Apr 18, 2023
a7f6fb0
Bump github.com/essentialkaos/ek/v12 from 12.64.0 to 12.64.1
dependabot[bot] Apr 19, 2023
31bc36f
Merge pull request #67 from essentialkaos/dependabot/go_modules/devel…
andyone Apr 19, 2023
679ac6b
Bump github.com/essentialkaos/ek/v12 from 12.64.1 to 12.65.0
dependabot[bot] Apr 28, 2023
4b4c060
Merge pull request #68 from essentialkaos/dependabot/go_modules/devel…
andyone Apr 28, 2023
d040616
Bump github.com/essentialkaos/ek/v12 from 12.65.0 to 12.66.0
dependabot[bot] May 4, 2023
ee1c055
Merge pull request #69 from essentialkaos/dependabot/go_modules/devel…
andyone May 4, 2023
39e0955
Bump github.com/essentialkaos/ek/v12 from 12.66.0 to 12.67.0
dependabot[bot] May 8, 2023
8293203
Merge pull request #70 from essentialkaos/dependabot/go_modules/devel…
andyone May 9, 2023
c678653
Bump github.com/essentialkaos/depsy from 1.0.0 to 1.1.0
dependabot[bot] May 12, 2023
c585bbb
Merge pull request #71 from essentialkaos/dependabot/go_modules/devel…
andyone May 12, 2023
27370be
Bump github.com/essentialkaos/ek/v12 from 12.67.0 to 12.67.1
dependabot[bot] May 15, 2023
878bf2c
Merge pull request #72 from essentialkaos/dependabot/go_modules/devel…
andyone May 15, 2023
a66d3b4
Bump github.com/essentialkaos/ek/v12 from 12.67.1 to 12.68.0
dependabot[bot] Jun 29, 2023
a44afee
Merge pull request #73 from essentialkaos/dependabot/go_modules/devel…
andyone Jun 29, 2023
1cfd4a1
Bump github.com/essentialkaos/ek/v12 from 12.68.0 to 12.69.0
dependabot[bot] Jul 14, 2023
e2428dc
Merge pull request #74 from essentialkaos/dependabot/go_modules/devel…
andyone Jul 14, 2023
2b98f97
Improve CI workflow
andyone Jul 14, 2023
9a688da
Bump github.com/essentialkaos/ek/v12 from 12.69.0 to 12.70.0
dependabot[bot] Jul 17, 2023
e43e723
Merge pull request #75 from essentialkaos/dependabot/go_modules/devel…
andyone Jul 17, 2023
049e466
Bump github.com/essentialkaos/ek/v12 from 12.70.0 to 12.72.0
dependabot[bot] Jul 25, 2023
30d9d12
Merge pull request #77 from essentialkaos/dependabot/go_modules/devel…
andyone Jul 25, 2023
3e051dd
Bump github.com/essentialkaos/ek/v12 from 12.72.0 to 12.73.1
dependabot[bot] Jul 27, 2023
0227724
Merge pull request #78 from essentialkaos/dependabot/go_modules/devel…
andyone Jul 27, 2023
fee7d72
Bump github.com/essentialkaos/ek/v12 from 12.73.1 to 12.73.2
dependabot[bot] Aug 1, 2023
7e0951b
Merge pull request #79 from essentialkaos/dependabot/go_modules/devel…
andyone Aug 1, 2023
b571fef
Bump github.com/essentialkaos/ek/v12 from 12.73.2 to 12.75.1
dependabot[bot] Aug 4, 2023
a9981ec
Merge pull request #81 from essentialkaos/dependabot/go_modules/devel…
andyone Aug 4, 2023
445a0a6
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 5, 2023
c7b5447
Merge pull request #82 from essentialkaos/dependabot/github_actions/d…
andyone Sep 5, 2023
e6e5ac3
Bump github.com/essentialkaos/ek/v12 from 12.75.1 to 12.76.1
dependabot[bot] Sep 15, 2023
d9ff626
Merge pull request #83 from essentialkaos/dependabot/go_modules/devel…
andyone Sep 18, 2023
9e5eced
Bump github.com/essentialkaos/ek/v12 from 12.76.1 to 12.77.1
dependabot[bot] Sep 25, 2023
45ac9aa
Merge pull request #84 from essentialkaos/dependabot/go_modules/devel…
andyone Sep 25, 2023
7f3bd44
Bump github.com/essentialkaos/ek/v12 from 12.77.1 to 12.78.0
dependabot[bot] Sep 29, 2023
9be14ff
Merge pull request #85 from essentialkaos/dependabot/go_modules/devel…
andyone Sep 29, 2023
6f919ae
Bump github.com/essentialkaos/ek/v12 from 12.78.0 to 12.79.0
dependabot[bot] Oct 3, 2023
0cbb51d
Merge pull request #86 from essentialkaos/dependabot/go_modules/devel…
andyone Oct 3, 2023
cb41c80
Bump github.com/essentialkaos/ek/v12 from 12.79.0 to 12.80.0
dependabot[bot] Oct 13, 2023
a5379aa
Merge pull request #87 from essentialkaos/dependabot/go_modules/devel…
andyone Oct 13, 2023
8beb9e9
Bump github.com/essentialkaos/ek/v12 from 12.80.0 to 12.82.0
dependabot[bot] Oct 17, 2023
669fd1b
Merge pull request #88 from essentialkaos/dependabot/go_modules/devel…
andyone Oct 17, 2023
0275269
Bump github.com/essentialkaos/ek/v12 from 12.82.0 to 12.83.1
dependabot[bot] Oct 24, 2023
0262fd1
Merge pull request #90 from essentialkaos/dependabot/go_modules/devel…
andyone Oct 25, 2023
43985ae
Bump github.com/essentialkaos/ek/v12 from 12.83.1 to 12.83.2
dependabot[bot] Nov 2, 2023
704f2ad
Merge pull request #91 from essentialkaos/dependabot/go_modules/devel…
andyone Nov 2, 2023
c01e8c6
Bump github.com/essentialkaos/ek/v12 from 12.83.2 to 12.84.0
dependabot[bot] Nov 14, 2023
8a64def
Merge pull request #92 from essentialkaos/dependabot/go_modules/devel…
andyone Nov 14, 2023
9b9f209
Bump github.com/essentialkaos/ek/v12 from 12.84.0 to 12.85.0
dependabot[bot] Nov 15, 2023
884d076
Merge pull request #93 from essentialkaos/dependabot/go_modules/devel…
andyone Nov 15, 2023
c2b9c3e
Bump github.com/essentialkaos/ek/v12 from 12.85.0 to 12.86.0
dependabot[bot] Nov 17, 2023
d7ba836
Merge pull request #94 from essentialkaos/dependabot/go_modules/devel…
andyone Nov 17, 2023
4d789a9
Bump github.com/essentialkaos/ek/v12 from 12.86.0 to 12.88.1
dependabot[bot] Nov 22, 2023
ee2ba96
Merge pull request #96 from essentialkaos/dependabot/go_modules/devel…
andyone Nov 22, 2023
8f54818
Bump github.com/essentialkaos/ek/v12 from 12.88.1 to 12.90.0
dependabot[bot] Nov 27, 2023
dace07a
Merge pull request #97 from essentialkaos/dependabot/go_modules/devel…
andyone Nov 29, 2023
8d7dbaf
Bump github.com/essentialkaos/ek/v12 from 12.90.0 to 12.90.1
dependabot[bot] Dec 4, 2023
e7d775a
Merge pull request #98 from essentialkaos/dependabot/go_modules/devel…
andyone Dec 4, 2023
2cea1c7
Bump actions/setup-go from 4 to 5
dependabot[bot] Dec 7, 2023
d7a32bb
Merge pull request #99 from essentialkaos/dependabot/github_actions/d…
andyone Dec 8, 2023
85ce1a3
Bump github.com/essentialkaos/ek/v12 from 12.90.1 to 12.91.0
dependabot[bot] Dec 12, 2023
c935a48
Merge pull request #100 from essentialkaos/dependabot/go_modules/deve…
andyone Dec 12, 2023
6750db2
Bump github.com/essentialkaos/ek/v12 from 12.91.0 to 12.92.0
dependabot[bot] Dec 14, 2023
d7a8a86
Bump github/codeql-action from 2 to 3
dependabot[bot] Dec 14, 2023
2c56a21
Merge pull request #102 from essentialkaos/dependabot/github_actions/…
andyone Dec 14, 2023
5a46546
Merge pull request #101 from essentialkaos/dependabot/go_modules/deve…
andyone Dec 14, 2023
93e38f7
Bump github.com/essentialkaos/ek/v12 from 12.92.0 to 12.93.0
dependabot[bot] Jan 11, 2024
f3e5d82
Merge pull request #103 from essentialkaos/dependabot/go_modules/deve…
andyone Jan 11, 2024
408e939
Bump github.com/essentialkaos/ek/v12 from 12.93.0 to 12.94.0
dependabot[bot] Jan 17, 2024
a1a68a0
Merge pull request #104 from essentialkaos/dependabot/go_modules/deve…
andyone Jan 17, 2024
aa43e83
Bump github.com/essentialkaos/ek/v12 from 12.94.0 to 12.96.1
dependabot[bot] Jan 22, 2024
64236b1
Merge pull request #106 from essentialkaos/dependabot/go_modules/deve…
andyone Jan 22, 2024
db51233
Bump github.com/essentialkaos/ek/v12 from 12.96.1 to 12.98.0
dependabot[bot] Jan 24, 2024
d874f57
Merge pull request #107 from essentialkaos/dependabot/go_modules/deve…
andyone Jan 24, 2024
8e0f5da
Bump github.com/essentialkaos/ek/v12 from 12.98.0 to 12.99.0
dependabot[bot] Feb 6, 2024
68a366d
Merge pull request #108 from essentialkaos/dependabot/go_modules/deve…
andyone Feb 7, 2024
82fc991
Bump github.com/essentialkaos/ek/v12 from 12.99.0 to 12.100.0
dependabot[bot] Feb 13, 2024
dbff274
Merge pull request #109 from essentialkaos/dependabot/go_modules/deve…
andyone Feb 13, 2024
7e15232
Bump github.com/essentialkaos/ek/v12 from 12.100.0 to 12.101.0
dependabot[bot] Feb 28, 2024
5a3fc86
Merge pull request #110 from essentialkaos/dependabot/go_modules/deve…
andyone Feb 28, 2024
0ed83ca
Bump github.com/essentialkaos/ek/v12 from 12.101.0 to 12.102.0
dependabot[bot] Mar 4, 2024
9a464d8
Merge pull request #111 from essentialkaos/dependabot/go_modules/deve…
andyone Mar 4, 2024
a5aa398
Bump github.com/essentialkaos/ek/v12 from 12.102.0 to 12.104.0
dependabot[bot] Mar 8, 2024
855eee1
Merge pull request #112 from essentialkaos/dependabot/go_modules/deve…
andyone Mar 9, 2024
e3e5f78
Bump github.com/essentialkaos/ek/v12 from 12.104.0 to 12.107.0
dependabot[bot] Mar 18, 2024
ece7130
Merge pull request #113 from essentialkaos/dependabot/go_modules/deve…
andyone Mar 18, 2024
950fd89
Bump github.com/essentialkaos/ek/v12 from 12.107.0 to 12.108.1
dependabot[bot] Mar 21, 2024
63f7ec0
Merge pull request #114 from essentialkaos/dependabot/go_modules/deve…
andyone Mar 21, 2024
d085b45
Bump github.com/essentialkaos/ek/v12 from 12.108.1 to 12.109.0
dependabot[bot] Mar 22, 2024
fd04b20
Merge pull request #115 from essentialkaos/dependabot/go_modules/deve…
andyone Mar 22, 2024
2c71da4
Bump github.com/essentialkaos/ek/v12 from 12.109.0 to 12.111.0
dependabot[bot] Mar 25, 2024
9acd818
Merge pull request #116 from essentialkaos/dependabot/go_modules/deve…
andyone Mar 25, 2024
0e6d946
Bump github.com/essentialkaos/ek/v12 from 12.111.0 to 12.111.1
dependabot[bot] Mar 27, 2024
35240ec
Merge pull request #117 from essentialkaos/dependabot/go_modules/deve…
andyone Mar 27, 2024
5765288
Improved support information gathering
andyone Mar 28, 2024
07e54ae
Improve CI workflow
andyone Mar 28, 2024
1b64101
Regenerate Makefile with the latest version of gomakegen
andyone Mar 28, 2024
639a4b1
Bump github.com/essentialkaos/ek/v12 from 12.111.1 to 12.113.0
dependabot[bot] Apr 1, 2024
7e8383d
Merge pull request #119 from essentialkaos/dependabot/go_modules/deve…
andyone Apr 1, 2024
7e3cbdc
Dependencies update
andyone Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 35 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ on:
branches: [master, develop]
pull_request:
branches: [master]

env:
SRC_DIR: src/github.com/${{ github.repository }}
workflow_dispatch:
inputs:
force_run:
description: 'Force workflow run'
required: true
type: choice
options: [yes, no]

permissions:
actions: read
contents: read
statuses: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Go:
Expand All @@ -16,23 +29,33 @@ jobs:

strategy:
matrix:
go: [ '1.19.x', '1.20.x' ]
go: [ '1.21.x', '1.22.x' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Checkout
uses: actions/checkout@v3
with:
path: ${{env.SRC_DIR}}

- name: Download dependencies
working-directory: ${{env.SRC_DIR}}
run: make deps

- name: Build binary
working-directory: ${{env.SRC_DIR}}
run: make all

Typos:
name: Typos
runs-on: ubuntu-latest

needs: Go

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check spelling
continue-on-error: true
uses: crate-ci/typos@master
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: go

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[files]
extend-exclude = ["go.sum"]
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################

# This Makefile generated by GoMakeGen 2.2.0 using next command:
# This Makefile generated by GoMakeGen 2.3.0 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen
Expand All @@ -13,6 +13,7 @@ ifdef VERBOSE ## Print verbose information (Flag)
VERBOSE_FLAG = -v
endif

COMPAT ?= 1.18
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)

Expand Down Expand Up @@ -50,7 +51,7 @@ else
endif

ifdef COMPAT ## Compatible Go version (String)
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT) -go=$(COMPAT)
else
go mod tidy $(VERBOSE_FLAG)
endif
Expand Down Expand Up @@ -94,6 +95,6 @@ help: ## Show this info
| sed 's/ifdef //' \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}'
@echo -e ''
@echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n'
@echo -e '\033[90mGenerated by GoMakeGen 2.3.0\033[0m\n'

################################################################################
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#### From source

To build the MDToc from scratch, make sure you have a working Go 1.18+ workspace ([instructions](https://golang.org/doc/install)), then:
To build the MDToc from scratch, make sure you have a working Go 1.18+ workspace ([instructions](https://go.dev/doc/install)), then:

```
go install github.com/essentialkaos/mdtoc
Expand Down
96 changes: 44 additions & 52 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,23 @@ import (
"github.com/essentialkaos/ek/v12/mathutil"
"github.com/essentialkaos/ek/v12/options"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/support"
"github.com/essentialkaos/ek/v12/support/deps"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/usage"
"github.com/essentialkaos/ek/v12/usage/completion/bash"
"github.com/essentialkaos/ek/v12/usage/completion/fish"
"github.com/essentialkaos/ek/v12/usage/completion/zsh"
"github.com/essentialkaos/ek/v12/usage/man"
"github.com/essentialkaos/ek/v12/usage/update"

"github.com/essentialkaos/mdtoc/cli/support"
)

// ////////////////////////////////////////////////////////////////////////////////// //

// App info
const (
APP = "MDToc"
VER = "1.2.5"
VER = "1.2.6"
DESC = "Utility for generating table of contents for markdown files"
)

Expand Down Expand Up @@ -72,7 +73,7 @@ var optMap = options.Map{
OPT_HTML: {Type: options.BOOL},
OPT_NO_COLOR: {Type: options.BOOL},
OPT_HELP: {Type: options.BOOL},
OPT_VER: {Type: options.BOOL},
OPT_VER: {Type: options.MIXED},

OPT_VERB_VER: {Type: options.BOOL},
OPT_COMPLETION: {},
Expand All @@ -86,6 +87,8 @@ var badgeRegExp = regexp.MustCompile(`\[!\[[^\]]*\]\((.*?)\s*("(?:.*[^"])")?\s*\

// Init is main function
func Init(gitRev string, gomod []byte) {
preConfigureUI()

args, errs := options.Parse(optMap)

if len(errs) != 0 {
Expand All @@ -100,17 +103,21 @@ func Init(gitRev string, gomod []byte) {

switch {
case options.Has(OPT_COMPLETION):
os.Exit(genCompletion())
os.Exit(printCompletion())
case options.Has(OPT_GENERATE_MAN):
os.Exit(genMan())
printMan()
os.Exit(0)
case options.GetB(OPT_VER):
showAbout(gitRev)
genAbout(gitRev).Print(options.GetS(OPT_VER))
os.Exit(0)
case options.GetB(OPT_VERB_VER):
support.ShowSupportInfo(APP, VER, gitRev, gomod)
support.Collect(APP, VER).
WithRevision(gitRev).
WithDeps(deps.Extract(gomod)).
Print()
os.Exit(0)
case options.GetB(OPT_HELP):
showUsage()
genUsage().Print()
os.Exit(0)
}

Expand All @@ -120,7 +127,7 @@ func Init(gitRev string, gomod []byte) {
file = findProperReadme()

if file == "" {
showUsage()
genUsage().Print()
os.Exit(0)
}
} else {
Expand All @@ -131,6 +138,13 @@ func Init(gitRev string, gomod []byte) {
process(file)
}

// preConfigureUI preconfigures UI based on information about user terminal
func preConfigureUI() {
if !tty.IsTTY() {
fmtc.DisableColors = true
}
}

// configureUI configures user interface
func configureUI() {
if options.GetB(OPT_NO_COLOR) {
Expand All @@ -150,20 +164,10 @@ func findProperReadme() string {

// checkFile checks markdown file before processing
func checkFile(file string) {
if !fsutil.IsExist(file) {
printErrorAndExit("Can't read file %s - file does not exist", file)
}

if !fsutil.IsRegular(file) {
printErrorAndExit("Can't read file %s - is not a file", file)
}
err := fsutil.ValidatePerms("FRS", file)

if !fsutil.IsReadable(file) {
printErrorAndExit("Can't read file %s - file is not readable", file)
}

if !fsutil.IsNonEmpty(file) {
printErrorAndExit("Can't read file %s - file is empty", file)
if err != nil {
printErrorAndExit(err.Error())
}
}

Expand Down Expand Up @@ -316,7 +320,7 @@ func makeLink(text string) string {
result := text

result = strings.TrimLeft(result, "# ")
result = strings.Replace(result, " ", "-", -1)
result = strings.ReplaceAll(result, " ", "-")
result = strings.ToLower(result)
result = strings.Join(anchorRegExp.FindAllString(result, -1), "")

Expand All @@ -337,7 +341,7 @@ func parseHeaderText(text string) (string, int) {
func removeMarkdownTags(header string) string {
for _, r := range "`_*~" {
if strings.Count(header, string(r))%2 == 0 {
header = strings.Replace(header, string(r), "", -1)
header = strings.ReplaceAll(header, string(r), "")
}
}

Expand Down Expand Up @@ -379,52 +383,40 @@ func printWarn(f string, a ...interface{}) {
fmtc.Fprintf(os.Stderr, "{y}"+f+"{!}\n", a...)
}

// printErrorAndExit prints error mesage and exit with exit code 1
// printErrorAndExit prints error message and exit with exit code 1
func printErrorAndExit(f string, a ...interface{}) {
printError(f, a...)
os.Exit(1)
}

// ////////////////////////////////////////////////////////////////////////////////// //

// showUsage prints usage info
func showUsage() {
genUsage().Render()
}

// showAbout prints info about version
func showAbout(gitRev string) {
genAbout(gitRev).Render()
}

// genCompletion generates completion for different shells
func genCompletion() int {
// printCompletion prints completion for given shell
func printCompletion() int {
info := genUsage()

switch options.GetS(OPT_COMPLETION) {
case "bash":
fmt.Printf(bash.Generate(info, "mdtoc"))
fmt.Print(bash.Generate(info, "mdtoc"))
case "fish":
fmt.Printf(fish.Generate(info, "mdtoc"))
fmt.Print(fish.Generate(info, "mdtoc"))
case "zsh":
fmt.Printf(zsh.Generate(info, optMap, "mdtoc"))
fmt.Print(zsh.Generate(info, optMap, "mdtoc"))
default:
return 1
}

return 0
}

// genMan generates man page
func genMan() int {
// printMan prints man page
func printMan() {
fmt.Println(
man.Generate(
genUsage(),
genAbout(""),
),
)

return 0
}

// genUsage generates usage info
Expand All @@ -448,17 +440,17 @@ func genUsage() *usage.Info {
// genAbout generates info about version
func genAbout(gitRev string) *usage.About {
about := &usage.About{
App: APP,
Version: VER,
Desc: DESC,
Year: 2006,
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
UpdateChecker: usage.UpdateChecker{"essentialkaos/mdtoc", update.GitHubChecker},
App: APP,
Version: VER,
Desc: DESC,
Year: 2006,
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
}

if gitRev != "" {
about.Build = "git:" + gitRev
about.UpdateChecker = usage.UpdateChecker{"essentialkaos/mdtoc", update.GitHubChecker}
}

return about
Expand Down
Loading