-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoc.go
148 lines (107 loc) · 3.54 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Copyright © 2015-2017 Daniele Tricoli <[email protected]>.
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
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 <[email protected]>
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 -- 🚪
*/
package main // import "eriol.xyz/piken"