|
1 | 1 | # CasingStyle |
2 | 2 |
|
3 | | -The `CasingStyle` PowerShell module provides functions for detecting, converting, and splitting different casing styles in strings. This can be |
4 | | -useful for text transformations, standardizing variable names, and ensuring consistent formatting in scripts. |
| 3 | +`CasingStyle` is a PowerShell module that detects, converts, and splits the casing style of text. Use it to normalize variable names, translate |
| 4 | +identifiers between conventions, and keep generated output consistently formatted. |
5 | 5 |
|
6 | | -## Prerequisites |
7 | | - |
8 | | -This module does not require additional dependencies, but it integrates well with the [PSModule framework](https://github.com/PSModule) for building, |
9 | | -testing, and publishing PowerShell modules. |
| 6 | +It recognizes `lowercase`, `UPPERCASE`, `Sentencecase`, `Title Case`, `PascalCase`, `camelCase`, `kebab-case`, `UPPER-KEBAB-CASE`, `snake_case`, and |
| 7 | +`UPPER_SNAKE_CASE`, and needs nothing beyond PowerShell itself. |
10 | 8 |
|
11 | 9 | ## Installation |
12 | 10 |
|
13 | | -To install the module from the PowerShell Gallery, you can use the following command: |
| 11 | +Install the module from the PowerShell Gallery: |
14 | 12 |
|
15 | 13 | ```powershell |
16 | 14 | Install-PSResource -Name CasingStyle |
17 | 15 | Import-Module -Name CasingStyle |
18 | 16 | ``` |
19 | 17 |
|
20 | | -## Usage |
21 | | - |
22 | | -The following examples demonstrate common use cases for the module, showing how it can be applied to detect, convert, and manipulate different casing |
23 | | -styles in strings. |
24 | | - |
25 | | -### Example 1: Convert a string to a different casing style |
26 | | - |
27 | | -```powershell |
28 | | -'thisIsCamelCase' | ConvertTo-CasingStyle -To 'snake_case' |
29 | | -# Output: this_is_camel_case |
30 | | -``` |
| 18 | +## Capabilities |
31 | 19 |
|
32 | | -```powershell |
33 | | -'thisIsCamelCase' | ConvertTo-CasingStyle -To 'UPPER_SNAKE_CASE' |
34 | | -# Output: THIS_IS_CAMEL_CASE |
35 | | -``` |
| 20 | +Detect the casing style of a string: |
36 | 21 |
|
37 | 22 | ```powershell |
38 | | -'thisIsCamelCase' | ConvertTo-CasingStyle -To 'kebab-case' |
39 | | -# Output: this-is-camel-case |
| 23 | +'testTestTest' | Get-CasingStyle |
| 24 | +# camelCase |
40 | 25 | ``` |
41 | 26 |
|
42 | | -### Example 2: Detect the casing style of a string |
| 27 | +Convert a string to another casing style, whichever style it starts in: |
43 | 28 |
|
44 | 29 | ```powershell |
45 | | -'testTestTest' | Get-CasingStyle |
46 | | -# Output: camelCase |
47 | | -``` |
| 30 | +'thisIsCamelCase' | ConvertTo-CasingStyle -To 'snake_case' |
| 31 | +# this_is_camel_case |
48 | 32 |
|
49 | | -```powershell |
50 | | -'TestTestTest' | Get-CasingStyle |
51 | | -# Output: PascalCase |
| 33 | +'this-is-kebab-case' | ConvertTo-CasingStyle -To 'PascalCase' |
| 34 | +# ThisIsKebabCase |
52 | 35 | ``` |
53 | 36 |
|
54 | | -### Example 3: Split a string based on casing style |
| 37 | +Split a string into the words its casing encodes, chaining styles when the text mixes several: |
55 | 38 |
|
56 | 39 | ```powershell |
57 | | -Split-CasingStyle -Text 'this-is-a-kebab-case-string' -By 'kebab-case' |
58 | | -# Output: |
| 40 | +'this_is_a-PascalString' | Split-CasingStyle -By 'snake_case', 'kebab-case', 'PascalCase' |
59 | 41 | # this |
60 | 42 | # is |
61 | 43 | # a |
62 | | -# kebab |
63 | | -# case |
64 | | -# string |
65 | | -``` |
66 | | - |
67 | | -```powershell |
68 | | -Split-CasingStyle -Text 'ThisIsAPascalCaseString' -By 'PascalCase' |
69 | | -# Output: |
70 | | -# This |
71 | | -# Is |
72 | | -# A |
73 | 44 | # Pascal |
74 | | -# Case |
75 | 45 | # String |
76 | 46 | ``` |
77 | 47 |
|
78 | | -### Find more examples |
79 | | - |
80 | | -To find more examples of how to use the module, please refer to the [examples](examples) folder. |
| 48 | +More end-to-end scenarios live in the [examples](examples) folder. |
81 | 49 |
|
82 | | -Alternatively, you can use the following PowerShell commands: |
| 50 | +## Documentation |
83 | 51 |
|
84 | | -```powershell |
85 | | -Get-Command -Module 'CasingStyle' |
86 | | -``` |
| 52 | +Documentation is published at [psmodule.io/CasingStyle](https://psmodule.io/CasingStyle/). |
87 | 53 |
|
88 | | -To find examples of each of the commands, you can use: |
| 54 | +Use PowerShell help and command discovery for module details: |
89 | 55 |
|
90 | 56 | ```powershell |
91 | | -Get-Help ConvertTo-CasingStyle -Examples |
| 57 | +Get-Command -Module CasingStyle |
| 58 | +Get-Help -Name ConvertTo-CasingStyle -Examples |
92 | 59 | ``` |
93 | | - |
94 | | -## Documentation |
95 | | - |
96 | | -For further documentation, please visit the official documentation pages for each function: |
97 | | - |
98 | | -- [ConvertTo-CasingStyle](https://psmodule.io/CasingStyle/Functions/ConvertTo-CasingStyle/) |
99 | | -- [Get-CasingStyle](https://psmodule.io/CasingStyle/Functions/Get-CasingStyle/) |
100 | | -- [Split-CasingStyle](https://psmodule.io/CasingStyle/Functions/Split-CasingStyle/) |
101 | | - |
102 | | -## Contributing |
103 | | - |
104 | | -Regardless of your experience level, your contributions are valuable! Whether you're a beginner or an expert, you can help improve this project by |
105 | | -sharing feedback, reporting issues, or contributing code. |
106 | | - |
107 | | -### For Users |
108 | | - |
109 | | -If you encounter unexpected behavior, errors, or missing functionality, you can help by submitting bug reports and feature requests. |
110 | | -Please see the issues tab on this project and submit a new issue that describes your experience. |
111 | | - |
112 | | -### For Developers |
113 | | - |
114 | | -If you write code, we'd love to have your contributions! Please read the [Contribution guidelines](CONTRIBUTING.md) for more information. |
115 | | -You can either help by picking up an existing issue or submit a new one if you have an idea for a new feature or improvement. |
0 commit comments