Skip to content

Commit 90ea69c

Browse files
committed
move --livevim into resultset
The 'search' command alias was missing --livevim. I realised that the flag really needs to be in the common rendering. It's a bit off because the source data loading still needs to be supported in each command which uses it, but the relevant commands all do.
1 parent 7904e8c commit 90ea69c

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

commands/browse/browse.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ var flags struct {
2323
blockname string
2424
limitAbort int
2525
listblocks bool
26-
livevim bool
2726
startrune int
2827
stoprune int
2928
}
@@ -54,7 +53,7 @@ Use "known -bv/-bn" to list known blocks for "browse -b".
5453
}
5554

5655
srcs := sources.NewFast()
57-
if flags.livevim {
56+
if resultset.ResultCmdFlags.LiveVim {
5857
srcs.LoadLiveVim()
5958
}
6059

@@ -165,7 +164,6 @@ func init() {
165164
browseCmd.Flags().IntVarP(&flags.limitAbort, "limit-abort", "A", 3000, "abort if would show more than this many entries")
166165
browseCmd.Flags().BoolVarP(&flags.listblocks, "list-blocks", "B", false, "list all available block names")
167166
browseCmd.Flags().MarkHidden("list-blocks") // moved to `known` sub-command
168-
browseCmd.Flags().BoolVarP(&flags.livevim, "livevim", "l", false, "load full vim data")
169167
browseCmd.Flags().IntVarP(&flags.startrune, "from", "f", 0, "show range starting at this value")
170168
browseCmd.Flags().IntVarP(&flags.stoprune, "to", "t", 0, "show range ending at this value")
171169
resultset.RegisterCmdFlags(browseCmd, false) // verbose v | net-verbose N | internal-debug; ; don't enable oneline

commands/code/code.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
var flags struct {
2626
base intconvBase
2727
clipboard bool
28-
livevim bool
2928
utf8hex bool
3029
}
3130

@@ -50,7 +49,7 @@ var codeCmd = &cobra.Command{
5049
}
5150

5251
srcs := sources.NewFast()
53-
if flags.livevim {
52+
if resultset.ResultCmdFlags.LiveVim {
5453
srcs.LoadLiveVim()
5554
}
5655

@@ -157,7 +156,6 @@ var codeCmd = &cobra.Command{
157156

158157
func init() {
159158
codeCmd.Flags().BoolVarP(&flags.clipboard, "clipboard", "c", false, "copy resulting chars to clipboard too")
160-
codeCmd.Flags().BoolVarP(&flags.livevim, "livevim", "l", false, "load full vim data (for verbose)")
161159
codeCmd.Flags().BoolVarP(&flags.utf8hex, "utf8hex", "H", false, "take UTF-8 Hex-encoded codepoint")
162160
codeCmd.Flags().VarP(&flags.base, "base", "b", "numeric base for code-ponts [default: usual parse rules]")
163161
resultset.RegisterCmdFlags(codeCmd, true) // verbose v | net-verbose N | internal-debug; enable oneline

commands/name/name.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
var flags struct {
2424
encoding string
2525
listEncodings bool
26-
livevim bool
2726
punyIn bool
2827
hexInput bool
2928
}
@@ -53,7 +52,7 @@ var nameCmd = &cobra.Command{
5352
}
5453

5554
srcs := sources.NewFast()
56-
if flags.livevim {
55+
if resultset.ResultCmdFlags.LiveVim {
5756
srcs.LoadLiveVim()
5857
}
5958
approxCharCount := 0
@@ -105,10 +104,6 @@ func init() {
105104
nameCmd.Flags().BoolVarP(&flags.listEncodings, "list-encodings", "", false, "list -e encodings & exit")
106105
nameCmd.Flags().BoolVarP(&flags.punyIn, "punycode-input", "p", false, "decode punycode on cmdline")
107106
resultset.RegisterCmdFlags(nameCmd, false) // verbose v | net-verbose N | internal-debug; don't enable oneline
108-
if resultset.CanTable() {
109-
nameCmd.Flags().BoolVarP(&flags.livevim, "livevim", "l", false, "load full vim data (for verbose)")
110-
}
111-
// FIXME: support verbose results without tables
112107

113108
root.AddCommand(nameCmd)
114109
}

commands/named/named.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
var flags struct {
2424
clipboard bool
2525
join bool
26-
livevim bool
2726
search bool
2827
unsorted bool
2928
htmlEntity bool
@@ -62,7 +61,7 @@ var namedCmd = &cobra.Command{
6261
if flags.search {
6362
srcs.LoadUnicodeSearch()
6463
}
65-
if flags.livevim {
64+
if resultset.ResultCmdFlags.LiveVim {
6665
srcs.LoadLiveVim()
6766
}
6867
results := resultset.New(srcs, len(args))
@@ -152,7 +151,6 @@ var namedCmd = &cobra.Command{
152151
func init() {
153152
namedCmd.Flags().BoolVarP(&flags.clipboard, "clipboard", "c", false, "copy resulting chars to clipboard too")
154153
namedCmd.Flags().BoolVarP(&flags.join, "join", "j", false, "all args are for one char name")
155-
namedCmd.Flags().BoolVarP(&flags.livevim, "livevim", "l", false, "load full vim data (for verbose)")
156154
namedCmd.Flags().BoolVarP(&flags.search, "search", "/", false, "search for words, not full name")
157155
namedCmd.Flags().BoolVarP(&flags.unsorted, "unsorted", "u", false, "do not sort search results")
158156
namedCmd.Flags().BoolVarP(&flags.htmlEntity, "html-entity", "H", false, "input words are HTML entity names")

resultset/cmdrender.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var ResultCmdFlags struct {
2323
Text bool
2424
Left bool
2525
Right bool
26+
LiveVim bool
2627
OmitColumns string
2728
}
2829

@@ -39,6 +40,7 @@ func RegisterCmdFlags(cmd *cobra.Command, supportOneline bool) {
3940
cmd.Flags().BoolVarP(&ResultCmdFlags.JSON, "json", "J", false, "show JSON output")
4041
cmd.Flags().BoolVarP(&ResultCmdFlags.NetVerbose, "net-verbose", "N", false, "show net-biased information (punycode, etc)")
4142
cmd.Flags().BoolVarP(&ResultCmdFlags.Verbose, "verbose", "v", false, "show information about the character")
43+
cmd.Flags().BoolVarP(&ResultCmdFlags.LiveVim, "livevim", "l", false, "load full vim data (for verbose)")
4244
cmd.Flags().StringVarP(&ResultCmdFlags.OmitColumns, "omit", "", "", "skip these columns entirely when printing (comma-separated list)")
4345
cmd.Flags().BoolVarP(&ResultCmdFlags.Emoji, "emoji-presentation", "E", false, "force emoji presentation")
4446
cmd.Flags().BoolVarP(&ResultCmdFlags.Text, "text-presentation", "T", false, "force text presentation")

0 commit comments

Comments
 (0)