Skip to content

sanohiro/txtk

Repository files navigation

txtk

Text manipulation toolkit for Unix pipelines.

Installation

brew tap sanohiro/txtk
brew install txtk

Tools

kase - Case converter

Convert between naming conventions.

echo "hello_world" | kase camel   # helloWorld
echo "helloWorld" | kase snake    # hello_world
echo "hello world" | kase kebab   # hello-world
echo "hello_world" | kase pascal  # HelloWorld
echo "hello_world" | kase upper   # HELLO_WORLD
echo "HELLO_WORLD" | kase lower   # hello_world
echo "hello world" | kase title   # Hello World

Subcommands: snake, camel, pascal, kebab, upper, lower, title


enco - Encoder/Decoder

Encode and decode various formats.

echo "hello world" | enco url           # hello%20world
echo "hello%20world" | enco url -d      # hello world
echo "<div>" | enco html                # &lt;div&gt;
echo "&lt;div&gt;" | enco html -d       # <div>

Subcommands: url, html

Options: -d, --decode - Decode mode (default is encode)


fcnv - Format converter

Convert between JSON, YAML, and TOML.

echo '{"name":"john"}' | fcnv yaml      # name: john
echo 'name: john' | fcnv json           # {"name":"john"}
echo 'name = "john"' | fcnv json        # {"name":"john"}
echo '{"a":1}' | fcnv json -p           # Pretty print
echo -e '{\n  "a": 1\n}' | fcnv json -c # Compact

Subcommands: json, yaml, toml

Options: -p, --pretty / -c, --compact (JSON only)


sqz - Squeeze repeated chars

Compress consecutive characters.

echo "a    b   c" | sqz                 # a b c
echo -e "a\n\n\nb" | sqz -n             # a\nb
echo "aaabbbccc" | sqz -c a             # abbbccc
echo "aaabbbccc" | sqz -a               # abc

Options: -n, --newlines, -t, --tabs, -c, --char <CHAR>, -a, --all


zen - Japanese text converter

Convert between fullwidth/halfwidth and hiragana/katakana.

echo "ABC123" | zen half         # ABC123
echo "ABC123" | zen full              # ABC123
echo "ひらがな" | zen kata            # ヒラガナ
echo "カタカナ" | zen hira            # かたかな
echo "カタカナ" | zen full --kana         # カタカナ

Subcommands: half, full, kata, hira

Options: -k, --kana - Also convert kana characters (half/full only)

License

MIT

About

Text manipulation toolkit for Unix pipelines

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages