decasify 0.3.0

A CLI utility and library to cast strings to title-case according to locale specific style guides including Turkish support
Documentation
# decasify

[![Rust Test Status](https://img.shields.io/github/actions/workflow/status/alerque/decasify/rust_test.yml?branch=master&label=Rust+Test&logo=Rust)](https://github.com/alerque/decasify/actions/workflows/rust_test.yml)
[![Rust Lint Status](https://img.shields.io/github/actions/workflow/status/alerque/decasify/rust_lint.yml?branch=master&label=Rust+Lint&logo=Rust)](https://github.com/alerque/decasify/actions/workflows/rust_list.yml)
[![Flake Run Status](https://img.shields.io/github/actions/workflow/status/alerque/decasify/nix.yml?branch=master&label=Flake&logo=NixOS)](https://github.com/alerque/decasify/actions/workflows/nix.yml)
[![Lua Lint Status](https://img.shields.io/github/actions/workflow/status/alerque/decasify/luacheck.yml?branch=master&label=Luacheck&logo=Lua)](https://github.com/alerque/decasify/actions/workflows/luacheck.yml)
[![Lua Test Status](https://img.shields.io/github/actions/workflow/status/alerque/decasify/busted.yml?branch=master&label=Busted&logo=Lua)](https://github.com/alerque/decasify/actions/workflows/busted.yml)  
[![GitHub tag (latest)](https://img.shields.io/github/v/tag/alerque/decasify)](https://github.com/alerque/decasify/releases)
[![Crates.io (latest)](https://img.shields.io/crates/v/decasify)](https://crates.io/crates/decasify)
[![LuaRocks (latest)](https://img.shields.io/luarocks/v/alerque/decasify)](https://luarocks.org/modules/alerque/decasify)

A CLI utility, Rust crate, and Lua module to cast strings to title-case according to locale specific style guides including Turkish support.

This project was born out of frustration with ALL CAPS TITLES in Markdown that no tooling seemed to properly support casting to title-casing strings, particularly coming from Turkish.
Many tools can handle casing single words, and many others can handle English strings, but nothing seemed to be out there for full Turkish strings.

Currently defaults to title-casing, others to come later.
Currently defaults to English rules, but the Turkish ones are actually more complete because that's my main use case.

For English, three style guides are known: Associated Press (AP), Chicago Manual of Style (CMOS), and John Grubber's Daring Fireball (Gruber).
The Gruber style is by far the most complete.
The CMOS style handles a number of parts of speech has punctuation related issues.
The AP style is largely unimplemented.
Contributions are welcome for better style guide support or further languages.

``` console
$ decasify -l tr ILIK SU VE İTEN RÜZGARLAR
Ilık Su ve İten Rüzgarlar
$ echo ILIK SU VE İTEN RÜZGARLAR | decasify -l tr
Ilık Su ve İten Rüzgarlar
$ echo foo BAR AND baz: an alter ego | decasify -l en -s gruber
Foo BAR and Baz: An Alter Ego
```

## Use as a Binary

Use of the CLI is pretty simple.
Input may be either shell arguments or STDIN.

```console
$ decasify --help
A CLI tool to convert all-caps strings to title-case or other less aggressive tones that supports
Turkish input

Usage: decasify [OPTIONS] [INPUT]...

Arguments:
  [INPUT]...  Input string

Options:
  -l, --locale <LOCALE>  Locale [default: EN] [possible values: EN, TR]
  -s, --style <STYLE>    Style Guide [possible values: ap, cmos, gruber]
  -h, --help             Print help
  -V, --version          Print version
```

First, check your distro for packages, e.g. for Arch Linux get it [from the AUR](https://aur.archlinux.org/packages/decasify).

Otherwise for most *nix platforms you can run it directly or install it to a shell using Nix Flakes:

``` console
$ nix run github:alerque/decasify
```

To install from source, grab the tarball or Git clone:

```console
# If using a Git clone (not needed for tarball releases):
$ ./bootstrap.sh
$ ./configure
$ make
$ sudo make install
```
Of course all the usual autotools options apply such as setting a prefix to install to.
Note the source installation will include a man page, and shell completions.

Of course the bare binary can also be installed with Cargo:

```console
$ cargo install --features cli decasify
```

## Use as Rust crate

In your `Cargo.toml` file.

```toml
[dependencies]
decasify = "0.3"
```

```rust
use decasify::to_titlecase;
use decasify::types::{InputLocale, StyleGuide};

fn main() {
    let input = "ILIK SU VE İTEN RÜZGARLAR";
    let output = to_titlecase(input, InputLocale::TR, None);
    eprintln! {"{output}"};
    let input = "title with a twist: a colon";
    let output = to_titlecase(input, InputLocale::EN, Some(StyleGuide::DaringFireball));
    eprintln! {"{output}"};
}
```

## Use as LuaRock

Depend on the LuaRock in your project or install with `luarocks install decasify`:

```lua
dependencies = {
   "decasify"
}

Then import ande use the provided function:

```lua
local decasify = require("decasify")
local input = "ILIK SU VE İTEN RÜZGARLAR"
local output = decasify.titlecase(input, "tr")
print(output)
input = "title with a twist: a colon"
output  = decasify.titlecase(input, "en", "gruber")
print(output)
```