Skip to content

Commit 05d57fa

Browse files
Kevin/0.7.0 (#45)
* feat: Add initial banner for initialization * feat: Added importing of resources and selection flow * chore: updated tsx file names to capital * feature: Added improvements to multi-select and completed the init flow * feat: Add json reporter * feat: Add a pre-filled sudo password * fix: promptSudo for all reporter types * fix: Fixed plain reporter for init * feat: Updated help for all commands * fix: Improved import help * feat: Modified the destroy flow to support asking users for identifying parameters * feat: Customized the prompt text for import and destroy * feat: Add ability for plugins to display a <press key to continue> prompt * feat: Fixed text wrapping which made it hard to copy the ssh key. Added static to fix message not displaying properly. Fixed progress not being displayed * fix: Fixed tests * fix: additional reporters * fix: lint errors
1 parent d43ef46 commit 05d57fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1540
-343
lines changed

README.md

Lines changed: 126 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ npm install -g codify
1818
$ codify COMMAND
1919
running command...
2020
$ codify (--version)
21-
codify/0.6.0 darwin-arm64 node-v20.15.1
21+
codify/0.7.0 darwin-arm64 node-v20.15.1
2222
$ codify --help [COMMAND]
2323
USAGE
2424
$ codify COMMAND
@@ -31,65 +31,89 @@ USAGE
3131
* [`codify destroy`](#codify-destroy)
3232
* [`codify help [COMMAND]`](#codify-help-command)
3333
* [`codify import`](#codify-import)
34+
* [`codify init`](#codify-init)
3435
* [`codify plan`](#codify-plan)
3536
* [`codify update [CHANNEL]`](#codify-update-channel)
3637

3738
## `codify apply`
3839

39-
Apply a codify file onto the system. A plan of the changes is first generated and a list of changes will be shown before proceeding
40+
Install or update resources on the system based on a codify.json file.
4041

4142
```
4243
USAGE
43-
$ codify apply [--json] [--debug] [-o plain|default|debug|json] [-s] [-p <value>]
44+
$ codify apply [--debug] [-o plain|default|json] [-p <value>] [-S <value>]
4445
4546
FLAGS
46-
-o, --output=<option> [default: default]
47-
<options: plain|default|debug|json>
48-
-p, --path=<value> Path to codify.json file
49-
-s, --secure
50-
--debug
51-
52-
GLOBAL FLAGS
53-
--json Format output as json.
47+
-S, --sudoPassword=<value> Automatically use this password for any commands that require elevated permissions.
48+
-o, --output=<option> [default: default] Control the output format.
49+
<options: plain|default|json>
50+
-p, --path=<value> Path to run Codify from.
51+
--debug Print additional debug logs.
5452
5553
DESCRIPTION
56-
Apply a codify file onto the system. A plan of the changes is first generated and a list of changes will be shown
57-
before proceeding
54+
Install or update resources on the system based on a codify.json file.
55+
56+
Codify first generates a plan to determine the necessary execution steps. See
57+
codify plan --help for more details.
58+
The execution plan will be presented and approval will be asked before Codify applies
59+
any changes.
60+
61+
For scripts: use --output json which will skip approval and
62+
apply changes directly.
63+
64+
For more information, visit: https://docs.codifycli.com/commands/apply
65+
5866
5967
EXAMPLES
6068
$ codify apply
6169
6270
$ codify apply --path ~
71+
72+
$ codify apply -o json
73+
74+
$ codify apply -S <sudo password>
6375
```
6476

65-
_See code: [src/commands/apply/index.ts](https://github.com/kevinwang5658/codify/blob/v0.6.0/src/commands/apply/index.ts)_
77+
_See code: [src/commands/apply.ts](https://github.com/kevinwang5658/codify/blob/v0.7.0/src/commands/apply.ts)_
6678

6779
## `codify destroy`
6880

69-
Destroy or uninstall a resource (or many resources).
81+
Use Codify to uninstall a supported package or setting on the system.
7082

7183
```
7284
USAGE
73-
$ codify destroy [--json] [--debug] [-o plain|default|debug|json] [-s] [-p <value>]
85+
$ codify destroy [--debug] [-o plain|default|json] [-p <value>] [-S <password>]
7486
7587
FLAGS
76-
-o, --output=<option> [default: default]
77-
<options: plain|default|debug|json>
78-
-p, --path=<value> Path to codify.json file
79-
-s, --secure
80-
--debug
81-
82-
GLOBAL FLAGS
83-
--json Format output as json.
88+
-S, --sudoPassword=<password> Automatically use this password for any commands that require elevated permissions.
89+
-o, --output=<option> [default: default] Control the output format.
90+
<options: plain|default|json>
91+
-p, --path=<value> Path to run Codify from.
92+
--debug Print additional debug logs.
8493
8594
DESCRIPTION
86-
Destroy or uninstall a resource (or many resources).
95+
Use Codify to uninstall a supported package or setting on the system.
96+
97+
This command will only work for resources with Codify support. This command
98+
can work with or without a codify.json file.
99+
100+
Modes:
101+
• If a codify.json file exists, destroy the resource specified in the Codify.json file
102+
with a matching type.
103+
• If a codify.json file doesn't exist, additional information may be asked to identify
104+
the specific resource to destroy.
105+
106+
For more information, visit: https://docs.codifycli.com/commands/destory
87107
88108
EXAMPLES
89109
$ codify destroy homebrew nvm
110+
111+
$ codify destroy homebrew nvm --path=~
112+
113+
$ codify destroy
90114
```
91115

92-
_See code: [src/commands/destroy.ts](https://github.com/kevinwang5658/codify/blob/v0.6.0/src/commands/destroy.ts)_
116+
_See code: [src/commands/destroy.ts](https://github.com/kevinwang5658/codify/blob/v0.7.0/src/commands/destroy.ts)_
93117

94118
## `codify help [COMMAND]`
95119

@@ -113,48 +137,50 @@ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.1
113137

114138
## `codify import`
115139

116-
Generate codify configs from already installed packages. Use a list of space separated arguments to specify the resource types to import. Leave blank to import all resource in an existing *.codify.json file.
140+
Generate Codify configurations from already installed packages.
117141

118142
```
119143
USAGE
120-
$ codify import [--json] [--debug] [-o plain|default|debug|json] [-s] [-p <value>]
144+
$ codify import [--debug] [-o plain|default|json] [-p <value>]
121145
122146
FLAGS
123-
-o, --output=<option> [default: default]
124-
<options: plain|default|debug|json>
125-
-p, --path=<value> Path to codify.json file
126-
-s, --secure
127-
--debug
128-
129-
GLOBAL FLAGS
130-
--json Format output as json.
147+
-o, --output=<option> [default: default] Control the output format.
148+
<options: plain|default|json>
149+
-p, --path=<value> Path to run Codify from.
150+
--debug Print additional debug logs.
131151
132152
DESCRIPTION
133-
Generate codify configs from already installed packages. Use a list of space separated arguments to specify the
134-
resource types to import. Leave blank to import all resource in an existing *.codify.json file.
153+
Generate Codify configurations from already installed packages.
154+
155+
Use a space-separated list of arguments to specify the resource types to import.
156+
If a codify.json file already exists, omit arguments to update the file to match the system.
135157
136158
Modes:
137-
1. No args: if no args are specified and an *.codify.json already exists. Then codify will update the existing file
138-
with any new changes to the resources specified in the file/files.
159+
1. No args: If no args are specified and an *.codify.json already exists, Codify
160+
will update the existing file with new changes on the system.
139161
140-
Command: codify import
162+
Command:
163+
codify import
141164
142-
2. With args: specify specific resources to import using arguments. Wild card matching is supported using '*' and ?
143-
(Note: in zsh * expands to the current dir and needs to be escaped using \* or '*'). A prompt will be shown if more
144-
information is required to complete the import.
165+
2. With args: Specify specific resources to import using arguments. Wild card matching is supported
166+
using '*' and '?' (Note: in zsh * expands to the current dir and needs to be escaped using \* or '*').
167+
A prompt will be shown if more information is required to complete the import.
145168
146-
Example: codify import nvm asdf\*, codify import \* (for importing all supported resources)
169+
Examples:
170+
codify import nvm asdf*
171+
codify import \* (for importing all supported resources)
147172
148-
The results can then be saved:
173+
The results can be saved in one of three ways:
149174
a. To an existing *.codify.json file
150175
b. To a new file
151-
c. Or only printed to console
176+
c. Printed to the console only
152177
153-
Codify will try to smartly insert new configs by following existing spacing and formatting.
178+
Codify will attempt to smartly insert new configurations while preserving existing spacing and formatting.
154179
180+
For more information, visit: https://docs.codifycli.com/commands/import
155181
156182
EXAMPLES
157-
$ codify import homebrew nvm asdf\*
183+
$ codify import homebrew nvm asdf
158184
159185
$ codify import
160186
@@ -163,35 +189,72 @@ EXAMPLES
163189
$ codify import \*
164190
```
165191

166-
_See code: [src/commands/import.ts](https://github.com/kevinwang5658/codify/blob/v0.6.0/src/commands/import.ts)_
192+
_See code: [src/commands/import.ts](https://github.com/kevinwang5658/codify/blob/v0.7.0/src/commands/import.ts)_
167193

168-
## `codify plan`
194+
## `codify init`
169195

170-
Generate a plan based on a codify.json file. This plan will list out the changes Codify will need to make in order to meet the desired config.
196+
A helper to quickly get started with Codify.
171197

172198
```
173199
USAGE
174-
$ codify plan [--json] [--debug] [-o plain|default|debug|json] [-s] [-p <value>]
200+
$ codify init [--debug] [-o plain|default|json]
175201
176202
FLAGS
177-
-o, --output=<option> [default: default]
178-
<options: plain|default|debug|json>
179-
-p, --path=<value> Path to codify.json file
180-
-s, --secure
181-
--debug
203+
-o, --output=<option> [default: default] Control the output format.
204+
<options: plain|default|json>
205+
--debug Print additional debug logs.
206+
207+
DESCRIPTION
208+
A helper to quickly get started with Codify.
182209
183-
GLOBAL FLAGS
184-
--json Format output as json.
210+
Use this command to automatically generate Codify configs based on
211+
the currently installed system resources. By default, the new file
212+
will be written to ~/codify.json .
213+
214+
For more information, visit: https://docs.codifycli.com/commands/init
215+
216+
EXAMPLES
217+
$ codify init
218+
```
219+
220+
_See code: [src/commands/init.ts](https://github.com/kevinwang5658/codify/blob/v0.7.0/src/commands/init.ts)_
221+
222+
## `codify plan`
223+
224+
Generate an execution plan to apply changes from a codify.json file.
225+
226+
```
227+
USAGE
228+
$ codify plan [--debug] [-o plain|default|json] [-p <value>]
229+
230+
FLAGS
231+
-o, --output=<option> [default: default] Control the output format.
232+
<options: plain|default|json>
233+
-p, --path=<value> Path to run Codify from.
234+
--debug Print additional debug logs.
185235
186236
DESCRIPTION
187-
Generate a plan based on a codify.json file. This plan will list out the changes Codify will need to make in order to
188-
meet the desired config.
237+
Generate an execution plan to apply changes from a codify.json file.
238+
239+
This plan lists all the changes Codify needs to make to apply the codify.json file.
240+
The plan will not be executed. Behind the scenes, Codify performs a refresh scan to
241+
determine the current configuration and installed resources, then compares them with
242+
the desired configuration to compute the execution plan.
243+
244+
For scripts: use --output json which will skip all prompts and print
245+
only the final result as a json.
246+
247+
For more information, visit: https://docs.codifycli.com/commands/plan
189248
190249
EXAMPLES
191250
$ codify plan
251+
252+
$ codify plan -o json
253+
254+
$ codify plan -p ../
192255
```
193256

194-
_See code: [src/commands/plan/index.ts](https://github.com/kevinwang5658/codify/blob/v0.6.0/src/commands/plan/index.ts)_
257+
_See code: [src/commands/plan.ts](https://github.com/kevinwang5658/codify/blob/v0.7.0/src/commands/plan.ts)_
195258

196259
## `codify update [CHANNEL]`
197260

0 commit comments

Comments
 (0)