annotate src/main/kotlin/name/blackcap/passman/ImportExportArguments.kt @ 19:7d80cbcb67bb

add shlex-style splitter and tests
author David Barts <n5jrn@me.com>
date Sun, 30 Jun 2024 20:37:36 -0700
parents 4427199eb218
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
1 package name.blackcap.passman
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
2
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
3 class ImportExportArguments {
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
4 private companion object {
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
5 const val D_CHARSET = "UTF-8"
17
4427199eb218 Make escape character RFC4180 compliant by default.
David Barts <n5jrn@me.com>
parents: 16
diff changeset
6 const val D_ESCAPE = '"'
16
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
7 const val D_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
8 const val D_QUOTE = '"'
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
9 const val D_SEPARATOR = ','
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
10 const val D_ZONE = "UTC"
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
11 }
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
12 @Argument(description = "Character set of CSV file (default $D_CHARSET).")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
13 var charset: String = D_CHARSET
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
14 @Argument(description = "CSV escape character (default $D_ESCAPE).")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
15 var escape: Char = D_ESCAPE
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
16 @Argument(description = "Do not ask before overwriting.")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
17 var force: Boolean = false
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
18 @Argument(description = "Time format (default $D_FORMAT).")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
19 var format: String = D_FORMAT
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
20 @Argument(description = "Print this help message.")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
21 var help: Boolean = false
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
22 @Argument(description = "Ignore white space before quoted strings.")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
23 var ignore: Boolean = false
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
24 @Argument(description = "CSV string-quoting character (default $D_QUOTE).")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
25 var quote: Char = D_QUOTE
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
26 @Argument(description = "CSV separator character (default $D_SEPARATOR).")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
27 var separator: Char = D_SEPARATOR
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
28 @Argument(description = "Skip first line of input", shortName = 'k')
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
29 var skip: Boolean = false
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
30 @Argument(description = "Time zone (default $D_ZONE).")
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
31 var zone: String = D_ZONE
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
32 }