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
Search ΒΆ
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 -- πͺ