Skip to content

Commit 29ba267

Browse files
committed
added csv2tab cli
1 parent c6e221e commit 29ba267

File tree

7 files changed

+37
-25
lines changed

7 files changed

+37
-25
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors:
1010
orcid: "https://orcid.org/0000-0003-0900-6903"
1111

1212
repository-code: "https://github.com/caltechlibrary/datatools"
13-
version: 1.1.3
13+
version: 1.2.0
1414
license-url: "https://data.caltech.edu/license"
1515
keywords: [ "csv", "json", "xlsx", "golang", "bash" ]
1616
date-released: 2022-06-30

about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors:
1111
orcid: "https://orcid.org/0000-0003-0900-6903"
1212

1313
repository-code: "https://github.com/caltechlibrary/datatools"
14-
version: 1.1.3
14+
version: 1.2.0
1515
license-url: "https://data.caltech.edu/license"
1616
keywords: [ "csv", "json", "xlsx", "golang", "bash" ]
1717
date-released: 2022-06-30
@@ -20,7 +20,7 @@ date-released: 2022-06-30
2020
About this software
2121
===================
2222

23-
## datatools 1.1.3
23+
## datatools 1.2.0
2424

2525
### Authors
2626

cmd/codemeta2cff/codemeta2cff.go

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3131
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3232
// POSSIBILITY OF SUCH DAMAGE.
33-
//
3433
package main
3534

3635
import (
@@ -44,37 +43,54 @@ import (
4443
"github.com/caltechlibrary/datatools"
4544
)
4645

47-
func usage(appName string, exitCode int) {
48-
out := os.Stderr
49-
if exitCode == 0 {
50-
out = os.Stdout
51-
}
52-
fmt.Fprintf(out, `
53-
USAGE: %s
46+
var (
47+
helpText = `% {app_name}(1) user manual
48+
% R. S. Doiel
49+
% 2022-10-28
50+
51+
# NAME
52+
53+
{app_name}
54+
55+
# SYSNOPSIS
5456
55-
%s [CODEMETA_JSON CITATION_CFF]
57+
{app_name} [OPTIONS] [CODEMETA_JSON CITATION_CFF]
58+
59+
# DESCRIPTION
5660
5761
Reads codemeta.json file and writes CITATION.cff. By default
5862
it assume both are in the current directory. You can also
5963
provide the name and path to both files.
6064
61-
OPTIONS
65+
# OPTIONS
6266
63-
-h, -help display help
67+
-help
68+
: display help
6469
65-
EXAMPLE
70+
# EXAMPLE
6671
6772
Generating the CITATION.cff from the codemeta.json file the current
6873
working directory.
6974
70-
%s
75+
~~~
76+
{app_name}
77+
~~~
7178
7279
Specifying the full paths.
7380
74-
%s /opt/local/myproject/codemeta.json /opt/local/myproject/CITATION.cff
81+
~~~
82+
{app_name} /opt/local/myproject/codemeta.json /opt/local/myproject/CITATION.cff
83+
~~~
84+
85+
`
86+
)
7587

76-
datatools v%s
77-
`, appName, appName, appName, appName, datatools.Version)
88+
func usage(appName string, exitCode int) {
89+
out := os.Stderr
90+
if exitCode == 0 {
91+
out = os.Stdout
92+
}
93+
fmt.Fprintf(out, "%s\n", strings.ReplaceAll(helpText, "{app_name}", appName))
7894
os.Exit(exitCode)
7995
}
8096

cmd/csv2json/csv2json.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//
21
// csv2json - is a command line that takes CSV input from stdin and
32
// writes out JSON expression. It includes support for using the first
43
// row as field names or default fieldnames (e.g. col0, col1, col2).
@@ -19,7 +18,6 @@
1918
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
2019
//
2120
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22-
//
2321
package main
2422

2523
import (

cmd/csv2mdtable/csv2mdtable.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//
21
// csv2mdtable - is a command line that takes CSV input from stdin and
32
// writes out a Github Flavored Markdown table.
43
//
@@ -16,7 +15,6 @@
1615
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
1716
//
1817
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19-
//
2018
package main
2119

2220
import (

codemeta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"downloadUrl": "https://github.com/caltechlibrary/datatools/releases/",
1010
"issueTracker": "https://github.com/caltechlibrary/datatools/issues",
1111
"name": "datatools",
12-
"version": "1.1.3",
12+
"version": "1.1.4",
1313
"description": "A set of command line tools for working with CSV, Excel Workbooks, JSON and structured text documents.",
1414
"applicationCategory": "computer programming",
1515
"developmentStatus": "active",

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package datatools
22

3-
const Version = "1.1.3"
3+
const Version = "1.2.0"
44

0 commit comments

Comments
 (0)