You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📝 [docs] Overhaul and enhance cmdlet documentation
This commit introduces a comprehensive overhaul of the external help documentation (Markdown and XML files) for all major cmdlets, alongside several code refinements and feature enhancements.
### Documentation (`📝 [docs]`)
- **Complete Rewrite**: The help content for `Add-ColorScriptProfile`, `Build-ColorScriptCache`, `Clear-ColorScriptCache`, and other cmdlets has been completely rewritten for clarity, accuracy, and detail.
- **Richer Examples**: Adds more diverse and practical examples for each cmdlet, including pipeline usage and combinations of parameters.
- **Improved Descriptions**: Parameter descriptions, notes, and cmdlet summaries are expanded to better explain the "why" behind features, their behavior, and best practices.
- **Standardization**: Ensures consistent formatting, structure, and tone across all help files, including updating the MAML XML to reflect the Markdown changes.
### Refactoring & Fixes (`🚜 [refactor]`)
- **Lazy Initialization**: The cache directory is no longer initialized on module import. Instead, it's created lazily on the first call to a function that requires it, improving module load times.
- **Code Simplification**:
- Refactors `Save-ColorScriptConfiguration` to remove a redundant variable, simplifying the logic for checking existing configuration content.
- Fixes a potential divide-by-zero error in `Build-ColorScriptCache`'s progress calculation when processing an empty set of scripts.
### Build & Metadata (`🔧 [build]`)
- **Build Output**: Modifies `.gitignore` to explicitly include the `dist` directory, ensuring it's available for packaging and distribution workflows.
- **Version Bump**: Increments the module version and updates the description to reflect the new total count of 498 colorscripts.
Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>
Adds a startup snippet to the specified PowerShell profile file. The snippet always imports the ColorScripts-Enhanced module and, unless suppressed, adds a call to `Show-ColorScript` so that a random colorscript is displayed on launch. The profile file is created if it does not already exist, and duplicate imports are avoided unless `-Force` is specified.
34
+
Adds a startup snippet to the specified PowerShell profile file. The snippet always imports the ColorScripts-Enhanced module and, unless suppressed with `-SkipStartupScript`, adds a call to `Show-ColorScript` so that a random colorscript is displayed on PowerShell launch.
35
+
36
+
The profile file is created automatically if it does not already exist. Duplicate imports are avoided unless `-Force` is specified.
42
37
43
-
The `-Path` parameter accepts relative paths, environment variables, and `~` expansion, making it easy to target profiles outside the default locations.
38
+
The `-Path` parameter accepts relative paths, environment variables, and `~` expansion, making it easy to target profiles outside the default locations. If `-Path` is not provided, the `-Scope` parameter determines which standard PowerShell profile to modify.
44
39
45
40
## EXAMPLES
46
41
47
42
### EXAMPLE 1
48
43
44
+
Add to the current user's profile for all hosts (default behavior).
45
+
49
46
```powershell
50
47
Add-ColorScriptProfile
51
48
```
52
49
53
-
Updates the CurrentUserAllHosts profile to import the module and show a random colorscript at startup.
50
+
This adds both the module import and `Show-ColorScript` call to `$PROFILE.CurrentUserAllHosts`.
54
51
55
52
### EXAMPLE 2
56
53
54
+
Add to the current user's profile for the current host only, without the startup script.
Append the snippet even if the profile already contains an `Import-Module ColorScripts-Enhanced` line.
108
+
Append the snippet even if the profile already contains an `Import-Module ColorScripts-Enhanced` line. Use this to force duplicate entries or re-add the snippet after manual removal.
Explicit profile path to update. Overrides `-Scope` when provided. Supports environment variables, relative paths, and `~` expansion.
127
-
Explicit profile path to update.
128
-
Overrides `-Scope` when provided.
129
-
Supports environment variables, relative paths, and `~` expansion.
151
+
Explicit profile path to update. Overrides `-Scope` when provided. Supports environment variables (e.g., `$env:USERPROFILE`), relative paths, and `~` expansion for the home directory.
130
152
131
153
```yaml
132
154
Type: System.String
133
-
DefaultValue: None
155
+
DefaultValue: ''
134
156
SupportsWildcards: false
135
157
Aliases: []
136
158
ParameterSets:
@@ -147,14 +169,11 @@ HelpMessage: ''
147
169
148
170
### -Scope
149
171
150
-
Profile scope to update when `-Path` is not supplied. Accepts PowerShell's standard profile properties (e.g., `CurrentUserAllHosts`, `CurrentUserCurrentHost`). Defaults to `CurrentUserAllHosts`.
151
-
Profile scope to update when `-Path` is not supplied.
152
-
Accepts PowerShell's standard profile properties (e.g., `CurrentUserAllHosts`, `CurrentUserCurrentHost`).
153
-
Defaults to `CurrentUserAllHosts`.
172
+
Profile scope to update when `-Path` is not supplied. Accepts PowerShell's standard profile properties: `CurrentUserAllHosts`, `CurrentUserCurrentHost`, `AllUsersAllHosts`, or `AllUsersCurrentHost`. Defaults to `CurrentUserAllHosts`.
154
173
155
174
```yaml
156
175
Type: System.String
157
-
DefaultValue: CurrentUserAllHosts
176
+
DefaultValue: 'CurrentUserAllHosts'
158
177
SupportsWildcards: false
159
178
Aliases: []
160
179
ParameterSets:
@@ -171,13 +190,11 @@ HelpMessage: ''
171
190
172
191
### -SkipStartupScript
173
192
174
-
Skip adding `Show-ColorScript` to the profile. Only the import line is appended.
175
-
Skip adding `Show-ColorScript` to the profile.
176
-
Only the import line is appended.
193
+
Skip adding `Show-ColorScript` to the profile. Only the `Import-Module ColorScripts-Enhanced` line is appended. Use this if you want to manually control when colorscripts are displayed.
@@ -227,25 +242,31 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
227
242
228
243
### None
229
244
230
-
You cannot pipe objects to this cmdlet.
245
+
This cmdlet does not accept pipeline input.
231
246
232
247
## OUTPUTS
233
248
234
249
### System.Object
235
250
236
-
Returns an object containing the profile path, whether a change was made, and a status message.
251
+
Returns a custom object with the following properties:
252
+
- **ProfilePath** (string): The full path to the modified profile file
253
+
- **Changed** (bool): Whether the profile was actually modified
254
+
- **Message** (string): A status message describing the operation result
237
255
238
256
## NOTES
239
257
240
-
Author: Nick
241
-
Module: ColorScripts-Enhanced
242
-
Requires: PowerShell 5.1 or later
258
+
**Author:** Nick
259
+
**Module:** ColorScripts-Enhanced
260
+
**Requires:** PowerShell 5.1 or later
261
+
262
+
The profile file is created automatically if it does not exist, including any necessary parent directories. Duplicate imports are detected and suppressed unless `-Force` is used.
243
263
244
-
The profile file is created automatically if it does not exist. Duplicate imports are suppressed unless `-Force` is used.
264
+
If you need elevated permissions to modify an AllUsers profile, ensure you run PowerShell as Administrator.
0 commit comments