mirror of
https://github.com/tmedwards/tweego.git
synced 2025-07-05 14:10:27 -04:00
parent
aba7e432ea
commit
a5565f8f3e
3 changed files with 32 additions and 0 deletions
|
@ -136,6 +136,7 @@ func newConfig() *config {
|
||||||
options.Add("json", "-j|--json")
|
options.Add("json", "-j|--json")
|
||||||
options.Add("listcharsets", "--list-charsets")
|
options.Add("listcharsets", "--list-charsets")
|
||||||
options.Add("listformats", "--list-formats")
|
options.Add("listformats", "--list-formats")
|
||||||
|
options.Add("listformatscsv", "--list-formats-csv")
|
||||||
options.Add("logfiles", "--log-files")
|
options.Add("logfiles", "--log-files")
|
||||||
options.Add("logstats", "-l|--log-stats")
|
options.Add("logstats", "-l|--log-stats")
|
||||||
options.Add("module", "-m=s+|--module=s+")
|
options.Add("module", "-m=s+|--module=s+")
|
||||||
|
@ -172,6 +173,8 @@ func newConfig() *config {
|
||||||
usageCharsets()
|
usageCharsets()
|
||||||
case "listformats":
|
case "listformats":
|
||||||
usageFormats(c.formats)
|
usageFormats(c.formats)
|
||||||
|
case "listformatscsv":
|
||||||
|
usageFormatsCSV(c.formats)
|
||||||
case "logfiles":
|
case "logfiles":
|
||||||
c.logFiles = true
|
c.logFiles = true
|
||||||
case "logstats":
|
case "logstats":
|
||||||
|
|
|
@ -48,6 +48,7 @@ Where <code>[options]</code> are mostly optional configuration flags—see [Opti
|
||||||
<dt><kbd>--head=FILE</kbd></dt><dd>Name of the file whose contents will be appended as-is to the <head> element of the compiled HTML.</dd>
|
<dt><kbd>--head=FILE</kbd></dt><dd>Name of the file whose contents will be appended as-is to the <head> element of the compiled HTML.</dd>
|
||||||
<dt><kbd>--list-charsets</kbd></dt><dd>List the supported input character sets, then exit.</dd>
|
<dt><kbd>--list-charsets</kbd></dt><dd>List the supported input character sets, then exit.</dd>
|
||||||
<dt><kbd>--list-formats</kbd></dt><dd>List the available story formats, then exit.</dd>
|
<dt><kbd>--list-formats</kbd></dt><dd>List the available story formats, then exit.</dd>
|
||||||
|
<dt><kbd>--list-formats-csv</kbd></dt><dd>List the available story formats as CSV, then exit.</dd>
|
||||||
<dt><kbd>--log-files</kbd></dt>
|
<dt><kbd>--log-files</kbd></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<p>Log the processed input files.</p>
|
<p>Log the processed input files.</p>
|
||||||
|
|
28
usage.go
28
usage.go
|
@ -45,6 +45,7 @@ Options:
|
||||||
-j, --json Output JSON, instead of compiled HTML.
|
-j, --json Output JSON, instead of compiled HTML.
|
||||||
--list-charsets List the supported input character sets, then exit.
|
--list-charsets List the supported input character sets, then exit.
|
||||||
--list-formats List the available story formats, then exit.
|
--list-formats List the available story formats, then exit.
|
||||||
|
--list-formats-csv List the available story formats as CSV, then exit.
|
||||||
--log-files Log the processed input files.
|
--log-files Log the processed input files.
|
||||||
-l, --log-stats Log various story statistics.
|
-l, --log-stats Log various story statistics.
|
||||||
-m SRC, --module=SRC Module sources (repeatable); may consist of supported
|
-m SRC, --module=SRC Module sources (repeatable); may consist of supported
|
||||||
|
@ -118,6 +119,33 @@ func usageFormats(formats storyFormatsMap) {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// formats the list of supported story formats as csv for the user
|
||||||
|
func usageFormatsCSV(formats storyFormatsMap) {
|
||||||
|
fmt.Fprintln(os.Stdout)
|
||||||
|
if formats.isEmpty() {
|
||||||
|
fmt.Fprintln(os.Stderr, "Story formats not found.")
|
||||||
|
os.Exit(1)
|
||||||
|
} else {
|
||||||
|
ids := formats.ids()
|
||||||
|
sort.Sort(StringsInsensitively(ids))
|
||||||
|
fmt.Fprintln(os.Stdout, "id,name,version,details")
|
||||||
|
for _, id := range ids {
|
||||||
|
f := formats[id]
|
||||||
|
fmt.Fprint(os.Stdout, f.id)
|
||||||
|
if f.isTwine2Style() {
|
||||||
|
fmt.Fprintf(os.Stdout, ",%s,%s,", f.name, f.version)
|
||||||
|
if f.proofing {
|
||||||
|
fmt.Fprint(os.Stdout, "proofing")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Fprint(os.Stdout, ",,,")
|
||||||
|
}
|
||||||
|
fmt.Fprintln(os.Stdout)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
func usageVersion() {
|
func usageVersion() {
|
||||||
fmt.Fprintf(os.Stderr, "\n%s, %s\n", tweegoName, tweegoVersion)
|
fmt.Fprintf(os.Stderr, "\n%s, %s\n", tweegoName, tweegoVersion)
|
||||||
fmt.Fprint(os.Stderr, `
|
fmt.Fprint(os.Stderr, `
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue