Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 73 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,115 @@
# {{ NAME }}
# CasingStyle

{{ DESCRIPTION }}
The `CasingStyle` PowerShell module provides functions for detecting, converting, and splitting different casing styles in strings. This can be
useful for text transformations, standardizing variable names, and ensuring consistent formatting in scripts.

## Prerequisites

This uses the following external resources:
- The [PSModule framework](https://github.com/PSModule) for building, testing and publishing the module.
This module does not require additional dependencies, but it integrates well with the [PSModule framework](https://github.com/PSModule) for building,
testing, and publishing PowerShell modules.

## Installation

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

```powershell
Install-PSResource -Name {{ NAME }}
Import-Module -Name {{ NAME }}
Install-PSResource -Name CasingStyle
Import-Module -Name CasingStyle
```

## Usage

Here is a list of example that are typical use cases for the module.
The following examples demonstrate common use cases for the module, showing how it can be applied to detect, convert, and manipulate different casing
styles in strings.

### Example 1: Greet an entity
### Example 1: Convert a string to a different casing style

Provide examples for typical commands that a user would like to do with the module.
```powershell
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'snake_case'
# Output: this_is_camel_case
```

```powershell
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'UPPER_SNAKE_CASE'
# Output: THIS_IS_CAMEL_CASE
```

```powershell
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'kebab-case'
# Output: this-is-camel-case
```

### Example 2: Detect the casing style of a string

```powershell
'testTestTest' | Get-CasingStyle
# Output: camelCase
```

```powershell
Greet-Entity -Name 'World'
Hello, World!
'TestTestTest' | Get-CasingStyle
# Output: PascalCase
```

### Example 2
### Example 3: Split a string based on casing style

Provide examples for typical commands that a user would like to do with the module.
```powershell
Split-CasingStyle -Text 'this-is-a-kebab-case-string' -By 'kebab-case'
# Output:
# this
# is
# a
# kebab
# case
# string
```

```powershell
Import-Module -Name PSModuleTemplate
Split-CasingStyle -Text 'ThisIsAPascalCaseString' -By 'PascalCase'
# Output:
# This
# Is
# A
# Pascal
# Case
# String
```

### Find more examples

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

Alternatively, you can use the Get-Command -Module 'This module' to find more commands that are available in the module.
To find examples of each of the commands you can use Get-Help -Examples 'CommandName'.
Alternatively, you can use the following PowerShell commands:

```powershell
Get-Command -Module 'CasingStyle'
```

To find examples of each of the commands, you can use:

```powershell
Get-Help ConvertTo-CasingStyle -Examples
```

## Documentation

Link to further documentation if available, or describe where in the repository users can find more detailed documentation about
the module's functions and features.
For further documentation, please visit the official documentation pages for each function:

- [ConvertTo-CasingStyle](https://psmodule.io/Casing/Functions/ConvertTo-CasingStyle/)
- [Get-CasingStyle](https://psmodule.io/Casing/Functions/Get-CasingStyle/)
- [Split-CasingStyle](https://psmodule.io/Casing/Functions/Split-CasingStyle/)

## Contributing

Coder or not, you can contribute to the project! We welcome all contributions.
Regardless of your experience level, your contributions are valuable! Whether you're a beginner or an expert, you can help improve this project by
sharing feedback, reporting issues, or contributing code.

### For Users

If you don't code, you still sit on valuable information that can make this project even better. If you experience that the
product does unexpected things, throw errors or is missing functionality, you can help by submitting bugs and feature requests.
Please see the issues tab on this project and submit a new issue that matches your needs.
If you encounter unexpected behavior, errors, or missing functionality, you can help by submitting bug reports and feature requests.
Please see the issues tab on this project and submit a new issue that describes your experience.

### For Developers

If you do code, we'd love to have your contributions. Please read the [Contribution guidelines](CONTRIBUTING.md) for more information.
If you write code, we'd love to have your contributions! Please read the [Contribution guidelines](CONTRIBUTING.md) for more information.
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.

## Acknowledgements

Here is a list of people and projects that helped this project in some way.
43 changes: 29 additions & 14 deletions examples/General.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
<#
.SYNOPSIS
This is a general example of how to use the module.
#>
# Example usage of Get-CasingStyle
# Detects the casing style of various strings

# Import the module
Import-Module -Name 'PSModule'
'testtesttest' | Get-CasingStyle # lowercase
'TESTTESTTEST' | Get-CasingStyle # UPPERCASE
'Testtesttest' | Get-CasingStyle # Sentencecase
'TestTestTest' | Get-CasingStyle # PascalCase
'testTestTest' | Get-CasingStyle # camelCase
'test-test-test' | Get-CasingStyle # kebab-case
'TEST-TEST-TEST' | Get-CasingStyle # UPPER-KEBAB-CASE
'test_test_test' | Get-CasingStyle # snake_case
'TEST_TEST_TEST' | Get-CasingStyle # UPPER_SNAKE_CASE
'Test_teSt-Test' | Get-CasingStyle # Mixed case with special characters

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

# Install the font
Install-Font -Path $FontFilePath -Verbose
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'snake_case' # Converts to 'this_is_camel_case'
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'UPPER_SNAKE_CASE' # Converts to 'THIS_IS_CAMEL_CASE'
'thisIsCamelCase' | ConvertTo-CasingStyle -To 'kebab-case' # Converts to 'this-is-camel-case'

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

# Uninstall the font
Get-Font -Name 'CodeNewRomanNerdFontPropo-Regular' | Uninstall-Font -Verbose
Split-CasingStyle -Text 'this-is-a-kebab-case-string' -By 'kebab-case' # Splits into words
Split-CasingStyle -Text 'this_is_a_kebab_case_string' -By 'snake_case' # Splits into words
Split-CasingStyle -Text 'ThisIsAPascalCaseString' -By 'PascalCase' # Splits into words
Split-CasingStyle -Text 'thisIsACamelCaseString' -By 'camelCase' # Splits into words

# Chained splitting example
Split-CasingStyle -Text 'this_is_a-CamelCaseString' -By kebab-case | Split-CasingStyle -By snake_case # Chained splitting

# Piped example with multiple styles
'this_is_a-PascalString' | Split-CasingStyle -By 'snake_case', 'kebab-case', 'PascalCase'