Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Commit fb1ce03

Browse files
author
R. S. Doiel
committed
commiting to master
1 parent 0f7c88d commit fb1ce03

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ test:
3838
clean:
3939
if [ -d bin ]; then rm -fR bin; fi
4040
if [ -d dist ]; then rm -fR dist; fi
41+
if [ -d man ]; then rm -fR man; fi
42+
43+
man: build
44+
mkdir -p man/man1
45+
bin/rss2json -generate-manpage | nroff -Tutf8 -man > man/man1/rss2json.1
4146

4247
dist/linux-amd64:
4348
mkdir -p dist/bin

cmd/rss2json/rss2json.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,19 @@ import (
3131
)
3232

3333
var (
34+
synopsis = `rss2json convers the RSS 2 XML to JSON`
35+
3436
description = `
35-
%s is a program that converts RSS v2's XML to JSON.
37+
_rss2json_ does one thing. It is a program that
38+
converts RSS v2 XML to JSON.
3639
`
3740

3841
examples = `
3942
Convert *rss.xml* to *rss.json*.
4043
41-
%s rss.xml rss.json
44+
` + "```" + `
45+
rss2json rss.xml rss.json
46+
` + "```" + `
4247
`
4348

4449
license = `
@@ -68,6 +73,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
6873
quiet bool
6974
newLine bool
7075
generateMarkdown bool
76+
generateManPage bool
7177

7278
// Application options
7379
prettyPrint bool
@@ -81,8 +87,9 @@ func main() {
8187
app.AddParams("INPUT_RSS_XML_FILENAME", "[OUTPUT_JSON_FILENAME]")
8288

8389
// Add Help Docs
84-
app.AddHelp("description", []byte(fmt.Sprintf(description, appName)))
85-
app.AddHelp("examples", []byte(fmt.Sprintf(examples, appName)))
90+
app.AddHelp("synopsis", []byte(synopsis))
91+
app.AddHelp("description", []byte(description))
92+
app.AddHelp("examples", []byte(examples))
8693
app.AddHelp("license", []byte(fmt.Sprintf(license, appName, rss2.Version)))
8794

8895
// Standard Options
@@ -95,6 +102,7 @@ func main() {
95102
app.StringVar(&inputFName, "i,input", "", "set input filename")
96103
app.StringVar(&outputFName, "o,output", "", "set output filename")
97104
app.BoolVar(&generateMarkdown, "generate-markdown", false, "generate Markdown documentation")
105+
app.BoolVar(&generateManPage, "generate-manpage", false, "generate man page")
98106

99107
// Application Options
100108
app.BoolVar(&prettyPrint, "p,pretty", false, "pretty print XML output")
@@ -127,6 +135,10 @@ func main() {
127135
app.GenerateMarkdown(os.Stdout)
128136
os.Exit(0)
129137
}
138+
if generateManPage {
139+
app.GenerateManPage(os.Stdout)
140+
os.Exit(0)
141+
}
130142
if showHelp || showExamples {
131143
if len(args) > 0 {
132144
fmt.Fprintln(app.Out, app.Help(args...))

rss2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"strings"
2828
)
2929

30-
const Version = `v0.0.2`
30+
const Version = `v0.0.3`
3131

3232
type CustomAttrs []xml.Attr
3333

0 commit comments

Comments
 (0)