Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Transition to Cobra CLI #333

Merged
merged 166 commits into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
483605e
First prototype of transition to cobra
edif2008 Aug 5, 2020
2582da5
Small adjustment to flags + fullCommand works
edif2008 Aug 6, 2020
d35f8d1
environment functions
hculea Aug 6, 2020
570b3fd
Adjust all files to new version of env (cobra adapted)
edif2008 Aug 8, 2020
b78ebfe
Fix lint using copy instead of loop
edif2008 Aug 8, 2020
0597985
some of the functions implemented properly. tested on secrethub read,…
hculea Aug 10, 2020
b9699bf
implemented existing file var in progress and stringmapvar
hculea Aug 10, 2020
ba69bc7
changed to another flag structure
hculea Aug 11, 2020
7f24ee3
the transition began.
hculea Aug 12, 2020
365d03d
formatted around a quarter of the files
hculea Aug 12, 2020
69fb50d
linter, not that it isn't my last concern
hculea Aug 12, 2020
f12f3a3
about 12 files left to modify
hculea Aug 12, 2020
47b91b6
force flag and timestamp flag
hculea Aug 12, 2020
6638102
2 more fixed files, 8 more to go
hculea Aug 12, 2020
1486eda
something i did yesterday
hculea Aug 13, 2020
aeea1c6
something's compiling
hculea Aug 13, 2020
306d7f2
something working
hculea Aug 13, 2020
f0d79d7
last 2 commands
hculea Aug 13, 2020
0ddb221
Small changes to make tests work again
edif2008 Aug 13, 2020
1058d4e
Make tests work
edif2008 Aug 13, 2020
789f884
Fix lint
edif2008 Aug 13, 2020
6032908
solved almost all todos
hculea Aug 13, 2020
6b2a9bb
Add app version
edif2008 Aug 13, 2020
382c19a
Fix tests and lint
edif2008 Aug 13, 2020
1b81c0c
Rename PreRun to argumentRegister
edif2008 Aug 13, 2020
5d1cddf
Add completion functionality into CLI
edif2008 Aug 13, 2020
3143890
added one forgotten flag optionality
hculea Aug 13, 2020
0ef995e
env.go
hculea Aug 14, 2020
2ef2a75
solved conflicts
hculea Aug 14, 2020
0c12014
wrapper for cobra
hculea Aug 14, 2020
64d5d22
Remove all persistentFlag calls
edif2008 Aug 14, 2020
b1381cb
formatted the out structure
hculea Aug 14, 2020
0e5d1ea
Auto stash before merge of "feature/cobra-switch" and "origin/feature…
edif2008 Aug 14, 2020
d5e13cc
Remove .idea files and final adjustments flags
edif2008 Aug 14, 2020
80989ed
first try env
hculea Aug 14, 2020
a2b62a8
Make environmental variables work
edif2008 Aug 14, 2020
de0a964
some cleanup
hculea Aug 14, 2020
c16cb7c
Remove dynamic path autocompletion
edif2008 Aug 14, 2020
337b3d6
Stop displaying the helper when an error occurs
edif2008 Aug 14, 2020
c43200e
solve to do
hculea Aug 18, 2020
e967af6
full command
hculea Aug 18, 2020
35c1b6a
get rid of boolValue
hculea Aug 18, 2020
a6e678c
Make first prototype of globalizing argument registration
edif2008 Aug 19, 2020
b6f32ec
get rid of bindaction1
hculea Aug 19, 2020
63942c6
first half done
hculea Aug 19, 2020
3c22f2f
Finish the other half
edif2008 Aug 19, 2020
3277ee5
replaced interface with field
hculea Aug 19, 2020
7e519c6
Fix lint
edif2008 Aug 19, 2020
673bde5
version that builds, with refactoring according to Marton's review
hculea Aug 19, 2020
f53515f
changed FlagRegister to Flag and got rid of unused parameter
hculea Aug 19, 2020
3e9b3d9
fix demo
hculea Aug 19, 2020
f6658d6
get rid of hasEnv use
hculea Aug 21, 2020
d85169f
Change flag structure
edif2008 Aug 21, 2020
4077521
first half done
hculea Aug 21, 2020
cb728a1
Finish second half
edif2008 Aug 21, 2020
b984332
Put the rest of the second half
edif2008 Aug 21, 2020
dc67661
no env var from prior implementation
hculea Aug 21, 2020
636f632
Merge branch 'feature/cobra-switch' of https://github.com/secrethub/s…
hculea Aug 21, 2020
39e7352
Wrap up no env var and fix lint
edif2008 Aug 21, 2020
b17eb7c
Rename cammand receiver
edif2008 Aug 21, 2020
3dc680d
Remove Cobra errors for missing arguments
hculea Oct 15, 2020
2ff9e16
Merge branch 'feature/cobra-switch' of https://github.com/secrethub/s…
hculea Oct 15, 2020
fa3f57c
Go-fmt project.
hculea Oct 15, 2020
b0e9fae
Go-imports 2 files
hculea Oct 15, 2020
08c2190
Remove unnecessary comment
hculea Oct 15, 2020
ff2bc8e
Make error handling missing argument
edif2008 Oct 15, 2020
b58ae24
Fix error more arguments than max provided
edif2008 Oct 15, 2020
56e94d8
Fix lint
edif2008 Oct 15, 2020
6f05be7
Fix 'clear clipboard' command's argument
edif2008 Oct 16, 2020
a39f4f0
Merge branch 'develop' into feature/cobra-switch
edif2008 Oct 16, 2020
27d8f77
Change custom MapValue type to Cobra StringToString type
edif2008 Oct 16, 2020
f47bda0
Wrap the ArgValue in an Argument struct
hculea Oct 16, 2020
82cfd3d
Handle case of too many arguments at argument registration
hculea Oct 16, 2020
fd69cd2
Fix demo init, update BindArguments parameters
hculea Oct 16, 2020
8a7ac3a
Bind Argument array to CommandClause
hculea Oct 16, 2020
4d0a0f2
Handle argument errors like Docker. Draft version, do not review yet.
hculea Oct 16, 2020
bf4cf4e
Fix styling
hculea Oct 16, 2020
76d4710
Adjust `secrethub run` command to work properly
edif2008 Oct 16, 2020
833bfe7
Merge branch 'develop' into feature/cobra-switch
hculea Oct 16, 2020
75f7fc2
Modularize argument error handling
hculea Oct 19, 2020
d5c03e6
First version of the custom help template
edif2008 Oct 27, 2020
fd0731e
Add argument helpers in the help template
edif2008 Oct 28, 2020
9d7a0b1
Implement a modular template
edif2008 Nov 21, 2020
03636e7
Remove code from previous version
edif2008 Nov 21, 2020
fcb750c
Add descriptions and placeholders for all arguments.
edif2008 Nov 21, 2020
a387f72
Add custom template for flags.
edif2008 Nov 22, 2020
aa70011
Reorganize code in env.go file and lint fixes
edif2008 Nov 22, 2020
8d948f7
Add empty line in usage template before `Example` section
edif2008 Nov 22, 2020
74ef124
Merge branch 'develop' into feature/cobra-switch
edif2008 Nov 22, 2020
e833f8c
Adjust help template and fix generate command
edif2008 Nov 28, 2020
e18ee32
Remove "Defaults to..." from help texts
edif2008 Nov 29, 2020
b9ccfe0
Fix minor flag usage parsing issue and fix lint
edif2008 Nov 29, 2020
6d075df
Remove duplicate help flag usage for commands with subcommands
edif2008 Nov 30, 2020
2bf3b2b
Remove commented lines that create the KingPin argument
edif2008 Dec 17, 2020
1753b22
Remove commented KingPin specific code
edif2008 Dec 17, 2020
4070695
Adjust argument types
edif2008 Dec 19, 2020
2bd4055
Merge branch 'develop' into feature/cobra-switch
edif2008 Dec 19, 2020
08080c6
Fix merge errors
edif2008 Dec 19, 2020
5e11801
Add command package to eliminate conflict of cli package for demo
edif2008 Dec 21, 2020
bddbab1
Fix flagCredentialReader initialization
edif2008 Dec 21, 2020
cc00c9e
Divide help text for args and flags into two columns
edif2008 Dec 21, 2020
02cb913
Make `api-remote` hidden
edif2008 Dec 21, 2020
d2914b7
Simplify credentialReader code
edif2008 Dec 21, 2020
093e421
Fix package conflict for demo command
edif2008 Dec 21, 2020
6419165
Enable autocompletion installation from CLI for bash
edif2008 Dec 21, 2020
ffa44eb
Adjust arg struct, remove commented import, fix global flags
edif2008 Dec 22, 2020
f01a214
Enable generation of autocompletion files for each shell, fix build
edif2008 Dec 22, 2020
04d3edd
Solve missed adjustments
edif2008 Dec 22, 2020
b6f159e
Remove commented import
edif2008 Dec 23, 2020
a9b26c5
Store list of flags for each command
Marton6 Dec 23, 2020
f0b2b9c
Use env vars of non-persistent flags
Marton6 Dec 23, 2020
4ac84f7
Fix persistent flag env vars (only on root command)
Marton6 Dec 23, 2020
51b99d4
Move PersistentFlags func and add comment
Marton6 Dec 23, 2020
882a760
Fix lint errors
Marton6 Dec 23, 2020
1e3c950
Set debug and mlock flags' no option default value
Marton6 Dec 23, 2020
c335b68
Rename App.Cmd -> App.Root
Marton6 Dec 23, 2020
883cbad
Merge pull request #362 from secrethub/feature/fix-cobra-bugs
Marton6 Dec 23, 2020
6b971e9
Split env.go into app.go, argument.go and flag.go
Marton6 Dec 23, 2020
28c3bb8
Rename cli.go to log.go
Marton6 Dec 23, 2020
76c9b16
Write errors with fmt.Fprint to avoid cast
Marton6 Dec 23, 2020
04eb86d
Fix typos in comments
Marton6 Dec 23, 2020
6bbd184
Move shortDur to flag.go
Marton6 Dec 23, 2020
5aff34a
Remove unused imports
edif2008 Dec 23, 2020
deb7e11
Merge pull request #363 from secrethub/feature/refactor-cobra-code
edif2008 Dec 23, 2020
5bf329b
Replace completion flag from kingpin with cobra's completion command
edif2008 Dec 28, 2020
b103c0e
Merge pull request #365 from secrethub/feature/fix-completion-err
edif2008 Dec 28, 2020
8591027
Rename template application function
edif2008 Dec 28, 2020
133f9c3
Move setting default filemode to command creation
edif2008 Dec 28, 2020
0399888
Remove code comments and make a const placeholder for `rm`
edif2008 Dec 28, 2020
52d1c98
Adjust error and help templates, make audit arg mandatory
edif2008 Dec 31, 2020
81905e1
Simplify debug and mlock flag creation
edif2008 Jan 5, 2021
bb65d49
Make mlock hidden and rearrange app functions
edif2008 Jan 5, 2021
8ef95aa
Implement hidden command
edif2008 Jan 5, 2021
d62f2cd
Add documentation for the template functions.
edif2008 Jan 5, 2021
5aa272c
Formulate better some comments for template functions.
edif2008 Jan 5, 2021
2153fb2
Remove hardcoded `secrethub` from error message.
edif2008 Jan 5, 2021
d2d6c8d
Fix mkdir and persistent flags envar names in help text
edif2008 Jan 5, 2021
5f23573
Make CLI work with the demo app
edif2008 Jan 5, 2021
930ced9
Deduplicate required check in useLine
jpcoenen Jan 6, 2021
8c1a534
Process environment variables for global flags in PersistentRunE
jpcoenen Jan 6, 2021
3fa8911
Rename argument structure's field.
edif2008 Jan 6, 2021
84f0307
Make minor adjustments
edif2008 Jan 6, 2021
3ac41e7
Make cleaner error messages.
edif2008 Jan 6, 2021
7aca744
Change `PreRunE` addition function signature
edif2008 Jan 6, 2021
f1646c1
Make help text nicer
edif2008 Jan 6, 2021
4051c7c
Fix lint
edif2008 Jan 6, 2021
f7560ef
Eliminate reusing string for `debug` and `mlock` flags
edif2008 Jan 6, 2021
f17580b
Add mlock and debug prerun functions as persistent prerun functions
edif2008 Jan 14, 2021
edf2cad
Simplify structures used as argument values
edif2008 Jan 14, 2021
6010a26
Fix tests
edif2008 Jan 14, 2021
505fc1a
Add error message case for minimum arguments
edif2008 Jan 14, 2021
f6f61dc
Simplify `Flag` function
edif2008 Jan 14, 2021
776094d
Fix lint
edif2008 Jan 14, 2021
2156ad4
Merge branch 'develop' into feature/cobra-switch
edif2008 Jan 14, 2021
8a7c5ed
Deduplicate and comment AddPreRunE
jpcoenen Jan 15, 2021
de07a25
Fix debug and mlock flag
jpcoenen Jan 15, 2021
4c4ff88
SImplify flag function
edif2008 Jan 16, 2021
3e66d14
Fix default description for service init
edif2008 Jan 16, 2021
d27bbea
Fix side-effects of checking type of argument
edif2008 Jan 17, 2021
ba40739
Fix lint
edif2008 Jan 17, 2021
b826d83
Revert "Fix side-effects of checking type of argument"
jpcoenen Jan 26, 2021
2b62d06
Create separate function for validating list arguments
jpcoenen Jan 26, 2021
34eac77
Add missing files to commit
jpcoenen Jan 26, 2021
cfe813c
Remove ignored directory to keep repo's consistency.
edif2008 Jan 29, 2021
961229a
Fix usage line for commands with subcommands
edif2008 Jan 30, 2021
d7e033d
Merge branch 'develop' into feature/cobra-switch
edif2008 Feb 12, 2021
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
2 changes: 1 addition & 1 deletion cmd/secrethub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func main() {
err := secrethub.NewApp().Version(secrethub.Version, secrethub.Commit).Run(os.Args[1:])
err := secrethub.NewApp().Version(secrethub.Version, secrethub.Commit).Run()
if err != nil {
handleError(err)
}
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ go 1.14

require (
bitbucket.org/zombiezen/cardcpx v0.0.0-20150417151802-902f68ff43ef
cloud.google.com/go v0.57.0 // indirect
github.com/alecthomas/kingpin v1.3.8-0.20200323085623-b6657d9477a6
github.com/atotto/clipboard v0.1.2
github.com/aws/aws-sdk-go v1.25.49
github.com/docker/go-units v0.3.3
Expand All @@ -15,12 +13,14 @@ require (
github.com/mattn/go-isatty v0.0.7
github.com/mitchellh/go-homedir v1.1.0
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/pkg/errors v0.9.1 // indirect
github.com/secrethub/demo-app v0.1.0
github.com/secrethub/secrethub-go v0.30.1-0.20201215150659-e5f45b9d8a0d
github.com/secrethub/demo-app v0.5.1-0.20210105185858-ad55afc2cb87
github.com/secrethub/secrethub-go v0.31.0
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5
github.com/zalando/go-keyring v0.0.0-20190208082241-fbe81aec3a07
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf
golang.org/x/text v0.3.2
google.golang.org/api v0.26.0
gopkg.in/yaml.v2 v2.2.2
Expand Down
132 changes: 99 additions & 33 deletions go.sum

Large diffs are not rendered by default.

Loading