Skip to content

Commit f75dd55

Browse files
📖 [Docs]: Update README and examples (#3)
## Description This pull request includes significant updates to the `README.md` file and the `examples/General.ps1` script to improve documentation and provide clearer examples of how to use the `CasingStyle` PowerShell module. Documentation improvements: * [`README.md`](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L1-L69): Updated the module name and description, added detailed usage examples, clarified installation instructions, and provided links to further documentation for each function. Example script enhancements: * [`examples/General.ps1`](diffhunk://#diff-7500894cc1140998449ea46c7fad0a638004283500a7f3c4b4a6d37f2b9ad186L1-R34): Replaced the generic example with specific usage examples of the `Get-CasingStyle`, `ConvertTo-CasingStyle`, and `Split-CasingStyle` functions, demonstrating various string transformations and detections. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] 📖 [Docs] - [ ] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 3626d41 commit f75dd55

File tree

2 files changed

+102
-41
lines changed

2 files changed

+102
-41
lines changed

README.md

Lines changed: 73 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,115 @@
1-
# {{ NAME }}
1+
# CasingStyle
22

3-
{{ DESCRIPTION }}
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.
45

56
## Prerequisites
67

7-
This uses the following external resources:
8-
- The [PSModule framework](https://github.com/PSModule) for building, testing and publishing the module.
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.
910

1011
## Installation
1112

1213
To install the module from the PowerShell Gallery, you can use the following command:
1314

1415
```powershell
15-
Install-PSResource -Name {{ NAME }}
16-
Import-Module -Name {{ NAME }}
16+
Install-PSResource -Name CasingStyle
17+
Import-Module -Name CasingStyle
1718
```
1819

1920
## Usage
2021

21-
Here is a list of example that are typical use cases for the module.
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.
2224

23-
### Example 1: Greet an entity
25+
### Example 1: Convert a string to a different casing style
2426

25-
Provide examples for typical commands that a user would like to do with the module.
27+
```powershell
28+
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'snake_case'
29+
# Output: this_is_camel_case
30+
```
31+
32+
```powershell
33+
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'UPPER_SNAKE_CASE'
34+
# Output: THIS_IS_CAMEL_CASE
35+
```
36+
37+
```powershell
38+
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'kebab-case'
39+
# Output: this-is-camel-case
40+
```
41+
42+
### Example 2: Detect the casing style of a string
43+
44+
```powershell
45+
'testTestTest' | Get-CasingStyle
46+
# Output: camelCase
47+
```
2648

2749
```powershell
28-
Greet-Entity -Name 'World'
29-
Hello, World!
50+
'TestTestTest' | Get-CasingStyle
51+
# Output: PascalCase
3052
```
3153

32-
### Example 2
54+
### Example 3: Split a string based on casing style
3355

34-
Provide examples for typical commands that a user would like to do with the module.
56+
```powershell
57+
Split-CasingStyle -Text 'this-is-a-kebab-case-string' -By 'kebab-case'
58+
# Output:
59+
# this
60+
# is
61+
# a
62+
# kebab
63+
# case
64+
# string
65+
```
3566

3667
```powershell
37-
Import-Module -Name PSModuleTemplate
68+
Split-CasingStyle -Text 'ThisIsAPascalCaseString' -By 'PascalCase'
69+
# Output:
70+
# This
71+
# Is
72+
# A
73+
# Pascal
74+
# Case
75+
# String
3876
```
3977

4078
### Find more examples
4179

4280
To find more examples of how to use the module, please refer to the [examples](examples) folder.
4381

44-
Alternatively, you can use the Get-Command -Module 'This module' to find more commands that are available in the module.
45-
To find examples of each of the commands you can use Get-Help -Examples 'CommandName'.
82+
Alternatively, you can use the following PowerShell commands:
83+
84+
```powershell
85+
Get-Command -Module 'CasingStyle'
86+
```
87+
88+
To find examples of each of the commands, you can use:
89+
90+
```powershell
91+
Get-Help ConvertTo-CasingStyle -Examples
92+
```
4693

4794
## Documentation
4895

49-
Link to further documentation if available, or describe where in the repository users can find more detailed documentation about
50-
the module's functions and features.
96+
For further documentation, please visit the official documentation pages for each function:
97+
98+
- [ConvertTo-CasingStyle](https://psmodule.io/Casing/Functions/ConvertTo-CasingStyle/)
99+
- [Get-CasingStyle](https://psmodule.io/Casing/Functions/Get-CasingStyle/)
100+
- [Split-CasingStyle](https://psmodule.io/Casing/Functions/Split-CasingStyle/)
51101

52102
## Contributing
53103

54-
Coder or not, you can contribute to the project! We welcome all contributions.
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.
55106

56107
### For Users
57108

58-
If you don't code, you still sit on valuable information that can make this project even better. If you experience that the
59-
product does unexpected things, throw errors or is missing functionality, you can help by submitting bugs and feature requests.
60-
Please see the issues tab on this project and submit a new issue that matches your needs.
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.
61111

62112
### For Developers
63113

64-
If you do code, we'd love to have your contributions. Please read the [Contribution guidelines](CONTRIBUTING.md) for more information.
114+
If you write code, we'd love to have your contributions! Please read the [Contribution guidelines](CONTRIBUTING.md) for more information.
65115
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.
66-
67-
## Acknowledgements
68-
69-
Here is a list of people and projects that helped this project in some way.

examples/General.ps1

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
1-
<#
2-
.SYNOPSIS
3-
This is a general example of how to use the module.
4-
#>
1+
# Example usage of Get-CasingStyle
2+
# Detects the casing style of various strings
53

6-
# Import the module
7-
Import-Module -Name 'PSModule'
4+
'testtesttest' | Get-CasingStyle # lowercase
5+
'TESTTESTTEST' | Get-CasingStyle # UPPERCASE
6+
'Testtesttest' | Get-CasingStyle # Sentencecase
7+
'TestTestTest' | Get-CasingStyle # PascalCase
8+
'testTestTest' | Get-CasingStyle # camelCase
9+
'test-test-test' | Get-CasingStyle # kebab-case
10+
'TEST-TEST-TEST' | Get-CasingStyle # UPPER-KEBAB-CASE
11+
'test_test_test' | Get-CasingStyle # snake_case
12+
'TEST_TEST_TEST' | Get-CasingStyle # UPPER_SNAKE_CASE
13+
'Test_teSt-Test' | Get-CasingStyle # Mixed case with special characters
814

9-
# Define the path to the font file
10-
$FontFilePath = 'C:\Fonts\CodeNewRoman\CodeNewRomanNerdFontPropo-Regular.tff'
15+
# Example usage of ConvertTo-CasingStyle
16+
# Converts a string to different casing styles
1117

12-
# Install the font
13-
Install-Font -Path $FontFilePath -Verbose
18+
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'snake_case' # Converts to 'this_is_camel_case'
19+
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'UPPER_SNAKE_CASE' # Converts to 'THIS_IS_CAMEL_CASE'
20+
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'kebab-case' # Converts to 'this-is-camel-case'
1421

15-
# List installed fonts
16-
Get-Font -Name 'CodeNewRomanNerdFontPropo-Regular'
22+
# Example usage of Split-CasingStyle
23+
# Splits a string based on different casing styles
1724

18-
# Uninstall the font
19-
Get-Font -Name 'CodeNewRomanNerdFontPropo-Regular' | Uninstall-Font -Verbose
25+
Split-CasingStyle -Text 'this-is-a-kebab-case-string' -By 'kebab-case' # Splits into words
26+
Split-CasingStyle -Text 'this_is_a_kebab_case_string' -By 'snake_case' # Splits into words
27+
Split-CasingStyle -Text 'ThisIsAPascalCaseString' -By 'PascalCase' # Splits into words
28+
Split-CasingStyle -Text 'thisIsACamelCaseString' -By 'camelCase' # Splits into words
29+
30+
# Chained splitting example
31+
Split-CasingStyle -Text 'this_is_a-CamelCaseString' -By kebab-case | Split-CasingStyle -By snake_case # Chained splitting
32+
33+
# Piped example with multiple styles
34+
'this_is_a-PascalString' | Split-CasingStyle -By 'snake_case', 'kebab-case', 'PascalCase'

0 commit comments

Comments
 (0)