#shortener #delimited #cli

app sqdj

sqdj shortens delimited data

2 releases

0.2.3 Sep 23, 2024
0.2.1 Sep 23, 2024

#371 in Text processing

MIT license

19KB
289 lines

sqdj

✨ Overview

sqdj shortens delimited data.

cat << EOF | sqdj
src/main/scala/admin/billing/ApplicationComponents.scala
src/main/scala/admin/billing/Components.scala
src/main/scala/admin/billing/Server.scala
EOF

# s/m/s/a/b/ApplicationComponents.scala
# s/m/s/a/b/Components.scala
# s/m/s/a/b/Server.scala

sqdj uses squidge behind the scenes.

💾 Installation

cargo:

cargo install sqdj
cargo install --git https://github.com/dhth/squidge.git --bin sqdj

⚡️ Usage

$ sqdj -h
sqdj shortens delimited data

Usage: sqdj [OPTIONS]

Options:
  -d, --delimiter <STRING>         Delimiter [default: /]
  -r, --ignore-regex <STRING>      Regex for ignoring elements (ie, they won't be shortened)
  -f, --ignore-first-n <NUMBER>    Ignore first n elements [default: 0]
  -l, --ignore-last-n <NUMBER>     Ignore last n elements [default: 1]
      --output-delimiter <STRING>  Output delimiter [default: /]
  -h, --help                       Print help
cat << EOF | sqdj --ignore-first-n 1
src/main/scala/admin/billing/ApplicationComponents.scala
src/main/scala/admin/billing/Components.scala
src/main/scala/admin/billing/Server.scala
EOF

# src/m/s/a/b/ApplicationComponents.scala
# src/m/s/a/b/Components.scala
# src/m/s/a/b/Server.scala
cat << EOF | sqdj --ignore-last-n 2
src/main/scala/admin/billing/ApplicationComponents.scala
src/main/scala/admin/billing/Components.scala
src/main/scala/admin/billing/Server.scala
EOF

# s/m/s/a/billing/ApplicationComponents.scala
# s/m/s/a/billing/Components.scala
# s/m/s/a/billing/Server.scala
cat << EOF | sqdj --ignore-regex 'billing|utils'
src/main/scala/admin/billing/api/PlayTapir.scala
src/main/scala/admin/billing/api/billing/BillingApiModule.scala
src/main/scala/admin/billing/api/utils/Authenticator.scala
EOF

# s/m/s/a/billing/a/PlayTapir.scala
# s/m/s/a/billing/a/billing/BillingApiModule.scala
# s/m/s/a/billing/a/utils/Authenticator.scala

Dependencies

~3.5–5MB
~86K SLoC