piken

command module
v0.0.0-...-983604d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2017 License: BSD-3-Clause Imports: 16 Imported by: 0

README ΒΆ

piken

piken is a CLI tool to search unicode data backed by SQLite3.

The name is in homage to the creators of UTF-8: Rob Pike and Ken Thompson.

Install

% go get eriol.xyz/piken

After installation use piken update to get unicode data from http://www.unicode.org/Public/UNIDATA/UnicodeData.txt.

Usage

% piken -h
NAME:
   piken - unicode search tool backed by SQLite3

USAGE:
   ./piken [global options] command [command options] [arguments...]

VERSION:
   0.1

AUTHOR(S):
   Daniele Tricoli <eriol@mornie.org>

COMMANDS:
   update       Update unicode data
   search, s    Search for unicode
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h           show help
   --version, -v        print the version

piken exposes SQLite3's full-text search on command line.

NOTE: if you are using zsh, it's useful to disable glob expressions with noglob (using an alias for example) instead of quote searches.

Default fields showed are codepoint and name, but it easy to override this:

% piken search red apple
1F34E -- RED APPLE -- 🍎

piken search --fields Name --fields Category --fields CodePoint red apple
RED APPLE -- So -- 1F34E -- 🍎

The following fields can be used:

  • CodePoint
  • Name
  • Category
  • CanonicalClass
  • BidiClass
  • DecompositionType
  • NumericType
  • NumericDigit
  • NumericValue
  • BidiMirrored
  • Unicode1Name
  • ISOComment
  • SimpleUppercaseMapping
  • SimpleLowercaseMapping
  • SimpleTitlecaseMapping
AND, OR, NOT operators
% piken search heart AND (blue OR green)
1F499 -- BLUE HEART -- πŸ’™
1F49A -- GREEN HEART -- πŸ’š

Note: operators must be uppercase.

* and ^ prefixes
% piken search mass*
1D340 -- TETRAGRAM FOR MASSING -- 𝍀
1F486 -- FACE MASSAGE -- πŸ’†
% piken search ^cat
1F408 -- CAT -- 🐈
1F431 -- CAT FACE -- 🐱
1F639 -- CAT FACE WITH TEARS OF JOY -- 😹
1F63C -- CAT FACE WITH WRY SMILE -- 😼
NEAR operator
% piken search crying face
1F622 -- CRYING FACE -- 😒
1F62D -- LOUDLY CRYING FACE -- 😭
1F63F -- CRYING CAT FACE -- 😿

% piken search crying NEAR/0 face
1F622 -- CRYING FACE -- 😒
1F62D -- LOUDLY CRYING FACE -- 😭
% piken search codepoint:1F602
1F602 -- FACE WITH TEARS OF JOY -- πŸ˜‚

% piken search doo* codepoint:A*
A585 -- VAI SYLLABLE DOO -- κ–…
A61B -- VAI SYMBOL DOONG -- κ˜›

% piken search category:Ll | wc -l
1984

% piken search math* frak* cap* NOT bold codepoint:1D50*
1D504 -- MATHEMATICAL FRAKTUR CAPITAL A -- 𝔄
1D505 -- MATHEMATICAL FRAKTUR CAPITAL B -- 𝔅
1D507 -- MATHEMATICAL FRAKTUR CAPITAL D -- 𝔇
1D508 -- MATHEMATICAL FRAKTUR CAPITAL E -- π”ˆ
1D509 -- MATHEMATICAL FRAKTUR CAPITAL F -- 𝔉
1D50A -- MATHEMATICAL FRAKTUR CAPITAL G -- π”Š
1D50D -- MATHEMATICAL FRAKTUR CAPITAL J -- 𝔍
1D50E -- MATHEMATICAL FRAKTUR CAPITAL K -- π”Ž
1D50F -- MATHEMATICAL FRAKTUR CAPITAL L -- 𝔏

# Note: Capital C and Capital H are missing from UnicodeData.txt
Copy into clipboard

Option --copy (compact form -c) can be used to copy the glyph directly into the clipboard when search return only one row:

% piken search --copy door
WARN[0000] Copy to clipboard not allowed for multiple rows.
2F3E -- KANGXI RADICAL DOOR -- βΌΎ
1F6AA -- DOOR -- πŸšͺ

% piken search --copy door NOT k*
1F6AA -- DOOR -- πŸšͺ

Documentation ΒΆ

Overview ΒΆ

piken is a CLI tool to search unicode data backed by SQLite3.

The name is in homage to the creators of UTF-8: Rob Pike and Ken Thompson.

Install

% go get eriol.xyz/piken

After installation use "piken update" to get unicode data from http://www.unicode.org/Public/UNIDATA/UnicodeData.txt:

% piken update

Usage

% piken -h
NAME:
   piken - unicode search tool backed by SQLite3

USAGE:
   ./piken [global options] command [command options] [arguments...]

VERSION:
   0.1

AUTHOR(S):
   Daniele Tricoli <eriol@mornie.org>

COMMANDS:
   update       Update unicode data
   search, s    Search for unicode
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h           show help
   --version, -v        print the version

piken exposes SQLite3's full-text search (see https://www.sqlite.org/fts3.html) on command line.

NOTE:if you are using zsh, it's useful to disable glob expressions with noglob (using an alias for example) instead of quote searches.

Default fields showed are codepoint and name, but it easy to override this:

% piken search red apple
1F34E -- RED APPLE -- 🍎

piken search --fields Name --fields Category --fields CodePoint red apple
RED APPLE -- So -- 1F34E -- 🍎

The following fields can be used:

CodePoint
Name
Category
CanonicalClass
BidiClass
DecompositionType
NumericType
NumericDigit
NumericValue
BidiMirrored
Unicode1Name
ISOComment
SimpleUppercaseMapping
SimpleLowercaseMapping
SimpleTitlecaseMapping

AND, OR, NOT operators

% piken search heart AND (blue OR green)
1F499 -- BLUE HEART -- πŸ’™
1F49A -- GREEN HEART -- πŸ’š

Note: operators must be uppercase.

* and ^ prefixes

% piken search mass*
1D340 -- TETRAGRAM FOR MASSING -- 𝍀
1F486 -- FACE MASSAGE -- πŸ’†

% piken search ^cat
1F408 -- CAT -- 🐈
1F431 -- CAT FACE -- 🐱
1F639 -- CAT FACE WITH TEARS OF JOY -- 😹
1F63C -- CAT FACE WITH WRY SMILE -- 😼

NEAR operator

% piken search crying face
1F622 -- CRYING FACE -- 😒
1F62D -- LOUDLY CRYING FACE -- 😭
1F63F -- CRYING CAT FACE -- 😿

% piken search crying NEAR/0 face
1F622 -- CRYING FACE -- 😒
1F62D -- LOUDLY CRYING FACE -- 😭

Specify column used to search

% piken search codepoint:1F602
1F602 -- FACE WITH TEARS OF JOY -- πŸ˜‚

% piken search doo* codepoint:A*
A585 -- VAI SYLLABLE DOO -- κ–…
A61B -- VAI SYMBOL DOONG -- κ˜›

% piken search category:Ll | wc -l
1984

% piken search math* frak* cap* NOT bold codepoint:1D50*
1D504 -- MATHEMATICAL FRAKTUR CAPITAL A -- 𝔄
1D505 -- MATHEMATICAL FRAKTUR CAPITAL B -- 𝔅
1D507 -- MATHEMATICAL FRAKTUR CAPITAL D -- 𝔇
1D508 -- MATHEMATICAL FRAKTUR CAPITAL E -- π”ˆ
1D509 -- MATHEMATICAL FRAKTUR CAPITAL F -- 𝔉
1D50A -- MATHEMATICAL FRAKTUR CAPITAL G -- π”Š
1D50D -- MATHEMATICAL FRAKTUR CAPITAL J -- 𝔍
1D50E -- MATHEMATICAL FRAKTUR CAPITAL K -- π”Ž
1D50F -- MATHEMATICAL FRAKTUR CAPITAL L -- 𝔏

# Note: Capital C and Capital H are missing from UnicodeData.txt

Copy into clipboard ΒΆ

Option "--copy" (compact form "-c") can be used to copy the glyph directly into the clipboard when search return only one row:

% piken search --copy door
WARN[0000] Copy to clipboard not allowed for multiple rows.
2F3E -- KANGXI RADICAL DOOR -- βΌΎ
1F6AA -- DOOR -- πŸšͺ

% piken search --copy door NOT k*
1F6AA -- DOOR -- πŸšͺ

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL