Skip to content

Commit ae24f6b

Browse files
committed
docs: add examples and demo
1 parent e85f550 commit ae24f6b

File tree

3 files changed

+74
-16
lines changed

3 files changed

+74
-16
lines changed

.github/assets/demo.gif

5.26 MB
Loading

README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -584,28 +584,14 @@ When multiple IdPs or Roles are available, `okta-aws-cli` presents an interactiv
584584
picker with fuzzy search capabilities. This makes it easy to find the right
585585
option even when you have many roles configured.
586586

587+
![Fuzzy Search Picker Demo](.github/assets/demo.gif)
588+
587589
**Features:**
588590
- **Fuzzy search**: Type to filter options - matches are highlighted
589591
- **Smart filtering**: Search is performed on the role/IdP name only (the part after the last `/`), not the full ARN
590592
- **Keyboard navigation**: Use ``/`` arrows to navigate, `Enter` to select, `Esc` to cancel
591593
- **Scroll indicators**: Shows count of items above/below when list is long
592594

593-
**Example:**
594-
595-
```
596-
? Choose a Role:
597-
598-
> Type to filter...
599-
600-
↑ 5 more above
601-
> arn:aws:iam::123456789012:role/admin <- selected, highlighted
602-
arn:aws:iam::123456789012:role/developer
603-
arn:aws:iam::123456789012:role/readonly
604-
↓ 10 more below
605-
606-
(esc to cancel)
607-
```
608-
609595
When typing `dev`, only roles containing "dev" in the role name will be shown,
610596
with the matching characters highlighted.
611597

examples/picker_demo.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//go:build ignore
2+
// +build ignore
3+
4+
/*
5+
* Copyright (c) 2026-Present, Okta, Inc.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
// This is a demo script to showcase the fuzzy search picker functionality.
21+
// Run this demo to see how the picker works with example AWS IAM roles.
22+
//
23+
// Usage:
24+
//
25+
// go run examples/picker_demo.go
26+
package main
27+
28+
import (
29+
"fmt"
30+
"os"
31+
32+
"github.com/okta/okta-aws-cli/v2/internal/picker"
33+
)
34+
35+
func main() {
36+
// Example AWS IAM roles with fake account IDs for demonstration
37+
roles := []string{
38+
"arn:aws:iam::123456789012:role/Admin",
39+
"arn:aws:iam::123456789012:role/Developer",
40+
"arn:aws:iam::123456789012:role/ReadOnly",
41+
"arn:aws:iam::123456789012:role/DevOps-Engineer",
42+
"arn:aws:iam::123456789012:role/Security-Analyst",
43+
"arn:aws:iam::987654321098:role/Production-Admin",
44+
"arn:aws:iam::987654321098:role/Production-Developer",
45+
"arn:aws:iam::987654321098:role/Production-ReadOnly",
46+
"arn:aws:iam::111222333444:role/Staging-Admin",
47+
"arn:aws:iam::111222333444:role/Staging-Developer",
48+
"arn:aws:iam::555666777888:role/QA-Tester",
49+
"arn:aws:iam::555666777888:role/QA-Lead",
50+
"arn:aws:iam::999000111222:role/Data-Engineer",
51+
"arn:aws:iam::999000111222:role/Data-Scientist",
52+
"arn:aws:iam::999000111222:role/ML-Engineer",
53+
}
54+
55+
fmt.Println("=== Okta AWS CLI - Fuzzy Search Picker Demo ===")
56+
fmt.Println()
57+
fmt.Println("Tips:")
58+
fmt.Println(" • Type to filter roles (searches role name, not full ARN)")
59+
fmt.Println(" • Use ↑/↓ arrows to navigate")
60+
fmt.Println(" • Press Enter to select")
61+
fmt.Println(" • Press Esc to cancel")
62+
fmt.Println()
63+
64+
selected, err := picker.Pick("Choose an AWS IAM Role:", roles)
65+
if err != nil {
66+
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
67+
os.Exit(1)
68+
}
69+
70+
fmt.Println()
71+
fmt.Printf("✓ Selected: %s\n", selected)
72+
}

0 commit comments

Comments
 (0)