Commit c9e51a3
refactor: modernize idpscimcli CLI with Go 1.26 best practices
- Fix logger initialization order: configure log handler options before
creating the handler, so log level/format from config takes effect.
- Replace os.Exit(1) in getGWSDirectoryService with error returns,
making the function testable and letting cobra handle the exit.
- Fix show() to return errors instead of silently discarding marshal
failures.
- Extract duplicated HTTP client builders into newSCIMHTTPClient() and
newGWSHTTPClient() helpers, reducing 3 identical builder blocks to 1.
- Extract newAWSSCIMService() helper to deduplicate SCIM service
creation across 3 AWS command handlers.
- Fix typos: "usrs" → "users", "Servive" → "Service" in help text.
- Use strings.TrimSuffix for config filename parsing instead of
fragile index slicing.
- Add unit tests for show() covering JSON, YAML, default format,
marshal errors, and empty structs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 0b3ea3b commit c9e51a3
5 files changed
Lines changed: 164 additions & 132 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
| |||
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
69 | | - | |
| 67 | + | |
70 | 68 | | |
71 | 69 | | |
72 | 70 | | |
| |||
87 | 85 | | |
88 | 86 | | |
89 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
90 | 98 | | |
91 | 99 | | |
92 | 100 | | |
93 | 101 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 102 | + | |
102 | 103 | | |
103 | | - | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | 106 | | |
108 | | - | |
| 107 | + | |
109 | 108 | | |
110 | | - | |
111 | 109 | | |
112 | 110 | | |
113 | 111 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 112 | + | |
117 | 113 | | |
118 | 114 | | |
119 | 115 | | |
120 | 116 | | |
121 | 117 | | |
122 | 118 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 119 | + | |
133 | 120 | | |
134 | | - | |
135 | 121 | | |
136 | 122 | | |
137 | | - | |
138 | 123 | | |
139 | | - | |
| 124 | + | |
140 | 125 | | |
141 | | - | |
142 | 126 | | |
143 | 127 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 128 | + | |
147 | 129 | | |
148 | | - | |
| 130 | + | |
149 | 131 | | |
150 | 132 | | |
151 | 133 | | |
152 | 134 | | |
153 | 135 | | |
154 | 136 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 137 | + | |
165 | 138 | | |
166 | | - | |
167 | 139 | | |
168 | 140 | | |
169 | | - | |
170 | 141 | | |
171 | | - | |
| 142 | + | |
172 | 143 | | |
173 | | - | |
174 | 144 | | |
175 | 145 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 146 | + | |
179 | 147 | | |
180 | | - | |
| 148 | + | |
181 | 149 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
16 | 13 | | |
17 | | - | |
18 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
| 26 | + | |
23 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
0 commit comments