Skip to content

Commit c6e4d35

Browse files
committed
fix flag conflicts of -I
1 parent 0408e13 commit c6e4d35

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
- [csvtk v0.18.2](https://github.com/shenwei356/csvtk/releases/tag/v0.18.2)
2+
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.18.2/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.18.2)
3+
- `csvtk replace/rename2/splitxlsx`: fix flag conflicts with global flag `-I`.
4+
- `csvtk replace/rename2`: removing shorthand flag `-I` for `--key-capt-idx`.
5+
- `csvtk splitxlsx`: changing shorthand flag of `--sheet-index` from `-I` to `-N`.
16
- [csvtk v0.18.1](https://github.com/shenwei356/csvtk/releases/tag/v0.18.1)
27
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.18.1/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.18.1)
38
- `csvtk sort`: fix mutiple-key-sort containing natural order sorting. [#79](https://github.com/shenwei356/csvtk/issues/79)

csvtk/cmd/rename2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Special replacement symbols:
4242
4343
{nr} ascending number, starting from --start-num
4444
{kv} Corresponding value of the key (captured variable $n) by key-value file,
45-
n can be specified by flag -I (--key-capt-idx) (default: 1)
45+
n can be specified by flag --key-capt-idx (default: 1)
4646
4747
4848
`,
@@ -333,7 +333,7 @@ func init() {
333333
rename2Cmd.Flags().StringP("kv-file", "k", "",
334334
`tab-delimited key-value file for replacing key with value when using "{kv}" in -r (--replacement)`)
335335
rename2Cmd.Flags().BoolP("keep-key", "K", false, "keep the key as value when no value found for the key")
336-
rename2Cmd.Flags().IntP("key-capt-idx", "I", 1, "capture variable index of key (1-based)")
336+
rename2Cmd.Flags().IntP("key-capt-idx", "", 1, "capture variable index of key (1-based)")
337337
rename2Cmd.Flags().StringP("key-miss-repl", "", "", "replacement for key with no corresponding value")
338338
rename2Cmd.Flags().IntP("start-num", "n", 1, `starting number when using {nr} in replacement`)
339339
rename2Cmd.Flags().BoolP("kv-file-all-left-columns-as-value", "A", false, "treat all columns except 1th one as value for kv-file with more than 2 columns")

csvtk/cmd/replace.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Special replacement symbols:
5555
5656
{nr} Record number, starting from 1
5757
{kv} Corresponding value of the key (captured variable $n) by key-value file,
58-
n can be specified by flag -I (--key-capt-idx) (default: 1)
58+
n can be specified by flag --key-capt-idx (default: 1)
5959
6060
`,
6161
Run: func(cmd *cobra.Command, args []string) {
@@ -345,7 +345,7 @@ func init() {
345345
replaceCmd.Flags().StringP("kv-file", "k", "",
346346
`tab-delimited key-value file for replacing key with value when using "{kv}" in -r (--replacement)`)
347347
replaceCmd.Flags().BoolP("keep-key", "K", false, "keep the key as value when no value found for the key")
348-
replaceCmd.Flags().IntP("key-capt-idx", "I", 1, "capture variable index of key (1-based)")
348+
replaceCmd.Flags().IntP("key-capt-idx", "", 1, "capture variable index of key (1-based)")
349349
replaceCmd.Flags().StringP("key-miss-repl", "", "", "replacement for key with no corresponding value")
350350
replaceCmd.Flags().IntP("nr-width", "", 1, `minimum width for {nr} in flag -r/--replacement. e.g., formating "1" to "001" by --nr-width 3`)
351351
replaceCmd.Flags().BoolP("kv-file-all-left-columns-as-value", "A", false, "treat all columns except 1th one as value for kv-file with more than 2 columns")

csvtk/cmd/splitxlsx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,5 +278,5 @@ func init() {
278278
splitXlsxCmd.Flags().BoolP("ignore-case", "i", false, `ignore case (cell value)`)
279279
splitXlsxCmd.Flags().StringP("sheet-name", "n", "", "sheet to retrieve")
280280
splitXlsxCmd.Flags().BoolP("list-sheets", "a", false, "list all sheets")
281-
splitXlsxCmd.Flags().IntP("sheet-index", "I", 1, "Nth sheet to retrieve")
281+
splitXlsxCmd.Flags().IntP("sheet-index", "N", 1, "Nth sheet to retrieve")
282282
}

doc/docs/usage.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ Flags:
15831583
-h, --help help for splitxlsx
15841584
-i, --ignore-case ignore case (cell value)
15851585
-a, --list-sheets list all sheets
1586-
-I, --sheet-index int Nth sheet to retrieve (default 1)
1586+
-N, --sheet-index int Nth sheet to retrieve (default 1)
15871587
-n, --sheet-name string sheet to retrieve
15881588
```
15891589

@@ -1826,7 +1826,7 @@ Special replacement symbols:
18261826
18271827
{nr} ascending number, starting from 1
18281828
{kv} Corresponding value of the key (captured variable $n) by key-value file,
1829-
n can be specified by flag -I (--key-capt-idx) (default: 1)
1829+
n can be specified by flag --key-capt-idx (default: 1)
18301830
18311831
Usage:
18321832
csvtk rename2 [flags]
@@ -1837,7 +1837,7 @@ Flags:
18371837
-h, --help help for rename2
18381838
-i, --ignore-case ignore case
18391839
-K, --keep-key keep the key as value when no value found for the key
1840-
-I, --key-capt-idx int capture variable index of key (1-based) (default 1)
1840+
--key-capt-idx int capture variable index of key (1-based) (default 1)
18411841
--key-miss-repl string replacement for key with no corresponding value
18421842
-k, --kv-file string tab-delimited key-value file for replacing key with value when using "{kv}" in -r (--replacement)
18431843
-p, --pattern string search regular expression
@@ -1924,7 +1924,7 @@ Special replacement symbols:
19241924
19251925
{nr} Record number, starting from 1
19261926
{kv} Corresponding value of the key (captured variable $n) by key-value file,
1927-
n can be specified by flag -I (--key-capt-idx) (default: 1)
1927+
n can be specified by flag --key-capt-idx (default: 1)
19281928
19291929
Usage:
19301930
csvtk replace [flags]
@@ -1935,7 +1935,7 @@ Flags:
19351935
-F, --fuzzy-fields using fuzzy fields, e.g., -F -f "*name" or -F -f "id123*"
19361936
-i, --ignore-case ignore case
19371937
-K, --keep-key keep the key as value when no value found for the key
1938-
-I, --key-capt-idx int capture variable index of key (1-based) (default 1)
1938+
--key-capt-idx int capture variable index of key (1-based) (default 1)
19391939
--key-miss-repl string replacement for key with no corresponding value
19401940
-k, --kv-file string tab-delimited key-value file for replacing key with value when using "{kv}" in -r (--replacement)
19411941
-p, --pattern string search regular expression

0 commit comments

Comments
 (0)