2.2.0 • Published 6 years ago

@kcpaulsen/ish v2.2.0

Weekly downloads
42
License
MIT
Repository
github
Last release
6 years ago

ish

When you need to find a string that's close... ish

Getting Started

npm install -g @kcpaulsen/ish
echo -e "Food\nDrink\nSnacks" | ish 'fod'
  # Food

Multi Matching

You can also provide multiple potential strings to match against. It will match left-to-right, favoring first potential matches over later ones, but fallback if sufficently mismatched

echo -e "Food\nDrink\nSnacks" | ish 'fodd' 'Drink'
  # Food

echo -e "Food\nDrink\nSnacks" | ish 'fdd' 'Dink'
  # Drink

JSON Output (simple and raw-string)

echo -e "Food\nDrink\nSnacks" | ish 'fodd' --json
  # "Food"

echo "Food" | ish 'food' --json-string
  # "\"Food\""

All matches Output

Listing all possible matches, left to right, best to worst.

echo -e "Food\nFodge\nFreak" | ish 'fo' --all --json
  # [ "Food", "Fodge", "Freak" ]

echo -e "Food\nFodge\nFreak" | ish 'fo' --all
  # Food
  # Fodge
  # Freak

Line matching mode

You can also match each line, individually, from a stream of lines. Each line is matched individually against the possible matches, left to right, best to worse.

  echo -e "cat cat kat\nkat kat kat\ndog dog alligator | ish --line 'dog' 'cat'

  # cat
  # kat
  # dog

Supported Options:

  --opts case-sensitive=true threshold=0.5 ...
  • case-sensitive
  • distance
  • threshold
  • tokenize
  • location
  • max-pattern-length
  • min-match-char-length

      echo "FOOD" | ish "food" --opts case-sensitive=true
        #
    
      echo "FOOD" | ish "FOOD" --opts case-sensitive=true
        # FOOD

    For more information on Fusejs options, see:

    https://fusejs.io

About

Heavily leveraging fuse.js (I mean heavy, like most-of-the-real-code), to make cli fuzzy matching, and outputing to other programs like jq, fx, eat, gron, easy and fun.

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.3.5

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.3

7 years ago

1.0.29

7 years ago

1.0.27

7 years ago

1.0.26

7 years ago

1.0.25

7 years ago

1.0.23

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.12

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago