Skip to content

Commit cc0f187

Browse files
authored
Merge pull request #1032 from synfinatic/improve-docs
cleanup docs and remove completions pre-1.9
2 parents b7757d5 + 575bd96 commit cc0f187

File tree

6 files changed

+30
-88
lines changed

6 files changed

+30
-88
lines changed

.codecov.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ coverage:
55
status:
66
project:
77
target: auto
8-
threshold: 0%
9-
paths:
10-
- internal/*
11-
- sso/*
8+
threshold: 0.25%
9+
10+
ignore:
11+
- cmd/**
1212

LICENSE.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
GNU General Public License
2-
==========================
1+
# GNU General Public License
32

43
_Version 3, 29 June 2007_
54
_Copyright © 2007 Free Software Foundation, Inc. &lt;<http://fsf.org/>&gt;_
@@ -593,4 +592,3 @@ more useful to permit linking proprietary applications with the library. If this
593592
what you want to do, use the GNU Lesser General Public License instead of this
594593
License. But first, please read
595594
&lt;<http://www.gnu.org/philosophy/why-not-lgpl.html>&gt;.
596-

cmd/aws-sso/completions_cmd.go

+6-42
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,18 @@ package main
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
2020
import (
21-
"bytes"
2221
"fmt"
2322
"os"
2423

2524
"github.com/synfinatic/aws-sso-cli/internal/helper"
26-
"github.com/willabides/kongplete"
2725
)
2826

2927
type CompleteCmd struct {
30-
Source bool `kong:"help='Print out completions for sourcing in the active shell',xor='action'"`
31-
Install bool `kong:"short='I',help='Install shell completions',xor='action'"`
32-
Uninstall bool `kong:"short='U',help='Uninstall shell completions',xor='action'"`
33-
UninstallPre19 bool `kong:"help='Uninstall pre-v1.9 shell completion integration',xor='action',xor='shell,script'"`
34-
Shell string `kong:"help='Override detected shell',xor='shell'"`
35-
ShellScript string `kong:"help='Override file to (un)install shell completions',xor='script'"`
28+
Source bool `kong:"help='Print out completions for sourcing in the active shell',xor='action'"`
29+
Install bool `kong:"short='I',help='Install shell completions',xor='action'"`
30+
Uninstall bool `kong:"short='U',help='Uninstall shell completions',xor='action'"`
31+
Shell string `kong:"help='Override detected shell'"`
32+
ShellScript string `kong:"help='Override file to (un)install shell completions'"`
3633
}
3734

3835
// AfterApply determines if SSO auth token is required
@@ -45,28 +42,13 @@ func (cc *CompleteCmd) Run(ctx *RunContext) error {
4542
var err error
4643

4744
if ctx.Cli.Setup.Completions.Source {
48-
err = helper.NewSourceHelper(os.Executable, os.Stdout).
49-
Generate(ctx.Cli.Setup.Completions.Shell)
45+
return helper.NewSourceHelper(os.Executable, os.Stdout).Generate(ctx.Cli.Setup.Completions.Shell)
5046
} else if ctx.Cli.Setup.Completions.Install {
5147
// install the current auto-complete helper
5248
err = helper.InstallHelper(ctx.Cli.Setup.Completions.Shell, ctx.Cli.Setup.Completions.ShellScript)
5349
} else if ctx.Cli.Setup.Completions.Uninstall {
5450
// uninstall the current auto-complete helper
5551
err = helper.UninstallHelper(ctx.Cli.Setup.Completions.Shell, ctx.Cli.Setup.Completions.ShellScript)
56-
} else if ctx.Cli.Setup.Completions.UninstallPre19 {
57-
// make sure we haven't installed our new completions first...
58-
if files := hasV19Installed(); len(files) == 0 {
59-
for _, f := range files {
60-
fmt.Printf("%s has the newer shell completions\n", f)
61-
}
62-
return fmt.Errorf("unable to automatically uninstall pre-1.9 shell completions")
63-
}
64-
65-
// Uninstall the old kongplete auto-complete helper
66-
kp := &kongplete.InstallCompletions{
67-
Uninstall: true,
68-
}
69-
err = kp.Run(ctx.Kctx)
7052
} else {
7153
err = fmt.Errorf("please specify a valid flag")
7254
}
@@ -76,21 +58,3 @@ func (cc *CompleteCmd) Run(ctx *RunContext) error {
7658
}
7759
return err
7860
}
79-
80-
// hasV19Installed returns the paths to any shell script we manage
81-
// that has the old < v1.9 completions installed or an empty list
82-
// if none exist.
83-
func hasV19Installed() []string {
84-
ret := []string{}
85-
for _, f := range helper.ConfigFiles() {
86-
b, err := os.ReadFile(f)
87-
if err != nil {
88-
continue
89-
}
90-
if bytes.Contains(b, []byte("# BEGIN_AWS_SSO_CLI\n")) {
91-
ret = append(ret, f)
92-
}
93-
}
94-
95-
return ret
96-
}

docs/commands.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,17 @@ quickstart.md#enabling-auto-completion-in-your-shell).
278278

279279
Flags:
280280

281+
* `--source` -- Print out the completions for sourcing into the current shell
281282
* `--install` -- Install the new v1.9+ shell completions scripts
282283
* `--uninstall` -- Uninstall the new v1.9+ shell completions scripts
283-
* `--uninstall-pre-19` -- Uninstall the legacy pre-v1.9 scripts
284284
* `--shell <shell>` -- Override the detected shell
285285
* `--shell-script <file>` -- Override the default shell script file to modify
286286

287-
**Note:** You should uninstall the older pre-v1.9 completions before installing
288-
the new version. Once the new version is installed, `--uninstall-pre-19` will
289-
refuse to run so you will have to either manually edit the file or run
290-
`--uninstall`, then `--uninstall-pre-19` and finally `--install` again.
287+
---
288+
289+
### setup ecs
290+
291+
See the [setup ecs](ecs-commands.md#setup-ecs) commands in the ECS Server command documentation.
291292

292293
---
293294

docs/ecs-commands.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ For information about the ECS Server functionality, see the [ecs-server](ecs-ser
44

55
## Commands
66

7-
### setup ecs auth
7+
### setup ecs
8+
9+
#### setup ecs auth
810

911
Configures the HTTP Authentication BearerToken. Once set, all future client
1012
requests to the ECS Server will need to provide the correct credentials.
@@ -20,7 +22,7 @@ Flags:
2022

2123
---
2224

23-
### setup ecs ssl
25+
#### setup ecs ssl
2426

2527
Configures the SSL Certificate and Private Key to enable SSL/TLS. Saves the
2628
SSL certificate and private key to the SecureStore.

docs/quickstart.md

+9-32
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
now part of [homebrew-core](
1313
https://github.com/Homebrew/homebrew-core/blob/master/Formula/a/aws-sso-cli.rb).
1414
* Option 4: Build from source:
15-
1. Install [GoLang](https://golang.org) v1.17+ and GNU Make
15+
1. Install [GoLang](https://golang.org) v1.22+ and GNU Make
1616
1. Clone this repo
1717
1. Run `make` (or `gmake` for GNU Make)
1818
1. Your binary will be created in the `dist` directory
1919
1. Run `make install` to install in /usr/local/bin
2020
* Option 5: `go install`:
21-
1. Install [GoLang](https://golang.org) v1.19+ and GNU Make
21+
1. Install [GoLang](https://golang.org) v1.22+ and GNU Make
2222
1. `go install github.com/synfinatic/aws-sso-cli/cmd/aws-sso@latest`
2323

2424
Note: macOS binaries must be build on macOS to enable Keychain support.
@@ -47,8 +47,8 @@ For more information about configuring `aws-sso` read the
4747
[configuration guide](config.md).
4848

4949
You can re-run through the configuration wizard at any time by running
50-
`aws-sso config`. By default, this only does a very basic setup; for a more
51-
advanced setup, use `aws-sso config --advanced`.
50+
`aws-sso setup wizard`. By default, this only does a very basic setup; for a more
51+
advanced setup, use `aws-sso setup wizard --advanced`.
5252

5353
## Enabling auto-completion in your shell
5454

@@ -65,34 +65,11 @@ shell for those changes to take effect.
6565
Guided setup should of prompted you to install auto-completions, but
6666
you can always re-run it for a different shell:
6767

68-
`aws-sso completions -I`
68+
`aws-sso setup completions -I`
6969

7070
or if you wish to uninstall them:
7171

72-
`aws-sso completions -U`
73-
74-
---
75-
76-
### Upgrading from before v1.9.0
77-
78-
First, there is no longer an `install-completions` command as of v1.9.0,
79-
that functionality (and more) has been moved to `completions`.
80-
81-
You should _first_ uninstall the old completions (sorry) and then install
82-
the new versions. This manual uninstall/re-install is a one time thing,
83-
but necessary.
84-
85-
1. `aws-sso completions --uninstall-pre-19`
86-
2. `aws-sso completions -I`
87-
88-
Users of older versions will note that starting in v1.9.0, running
89-
`completions -I` or `completions -U` will present you a diff of file changes
90-
for you to accept.
91-
92-
Also, unlike with older versions, only your current shell is modified when
93-
you run `completions -I` or `completions -U`, but
94-
`completions --uninstall-pre-19` uses the original code/library and will
95-
modify your `bash`, `zsh` and `fish` init scripts.
72+
`aws-sso setup completions -U`
9673

9774
---
9875

@@ -101,7 +78,7 @@ modify your `bash`, `zsh` and `fish` init scripts.
10178
Upgrading from versions 1.9.0 or better is just like installing for
10279
first time users:
10380

104-
`aws-sso completions -I`
81+
`aws-sso setup completions -I`
10582

10683
Any changes will be presented to you in diff format and you will be given
10784
the option to accept or reject the changes.
@@ -111,7 +88,7 @@ the option to accept or reject the changes.
11188
### More information
11289

11390
More information on auto-completion can be found in the documentation
114-
for the [completions command](commands.md#completions).
91+
for the [setup completions](commands.md#setup-completions) command.
11592

11693
## Use `aws-sso` on the CLI for AWS API calls
11794

@@ -191,7 +168,7 @@ and the `$AWS_PROFILE` environment variable, AWS SSO CLI can support that as wel
191168

192169
#### Configuration
193170

194-
Run: `aws-sso config-profiles`
171+
Run: `aws-sso setup profiles`
195172

196173
This will add the following lines (example) to your `~/.aws/config` file:
197174

0 commit comments

Comments
 (0)