Skip to content

Commit

Permalink
prep for v1.2.12 release
Browse files Browse the repository at this point in the history
  • Loading branch information
R. S. Doiel committed Nov 7, 2024
1 parent 1128bff commit f838334
Show file tree
Hide file tree
Showing 104 changed files with 185 additions and 150 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ maintainers:
orcid: "https://orcid.org/0000-0003-0900-6903"

repository-code: "https://github.com/caltechlibrary/datatools"
version: 1.2.11
version: 1.2.12
license-url: "https://data.caltech.edu/license"
keywords: [ "csv", "excel", "sql", "json", "yaml", "xlsx", "golang", "bash" ]
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ RELEASE_DATE=$(shell date +'%Y-%m-%d')

RELEASE_HASH=$(shell git log --pretty=format:'%h' -n 1)


PROGRAMS = codemeta2cff csv2json csv2mdtable csv2tab csv2xlsx csvcleaner csvcols csvfind csvjoin csvrows finddir findfile json2toml json2yaml jsoncols jsonjoin jsonmunge jsonrange mergepath range reldate reltime sql2csv string tab2csv timefmt toml2json urlparse xlsx2csv xlsx2json yaml2json jsonobjects2csv

MAN_PAGES = codemeta2cff.1 csv2json.1 csv2mdtable.1 csv2tab.1 csv2xlsx.1 csvcleaner.1 csvcols.1 csvfind.1 csvjoin.1 csvrows.1 finddir.1 findfile.1 json2toml.1 json2yaml.1 jsoncols.1 jsonjoin.1 jsonmunge.1 jsonrange.1 mergepath.1 range.1 reldate.1 reltime.1 sql2csv.1 string.1 tab2csv.1 timefmt.1 toml2json.1 urlparse.1 xlsx2csv.1 xlsx2json.1 yaml2json.1 jsonobjects2csv.1
Expand Down Expand Up @@ -48,9 +47,6 @@ version.go: .FORCE
--template codemeta-version-go.tmpl \
LICENSE >version.go




about.md: codemeta.json .FORCE
cat codemeta.json | sed -E 's/"@context"/"at__context"/g;s/"@type"/"at__type"/g;s/"@id"/"at__id"/g' >_codemeta.json
if [ -f $(PANDOC) ]; then echo "" | $(PANDOC) --metadata title="About $(PROJECT)" --metadata-file=_codemeta.json --template=codemeta-md.tmpl >about.md; fi
Expand Down Expand Up @@ -218,7 +214,7 @@ gen_batfiles: .FORCE

snap: dist/datatools_$(VERSION)_amd64.snap

release: .FORCE installer.sh clean build man gen_batfiles distribute_docs dist/Linux-x86_64 dist/macOS-x86_64 dist/macOS-arm64 dist/Windows-x86_64 dist/Windows-arm64 dist/Linux-armv7l dist/Linux-aarch64
release: .FORCE clean build man gen_batfiles distribute_docs dist/Linux-armv7l dist/Linux-aarch64 dist/Linux-x86_64 dist/macOS-x86_64 dist/macOS-arm64 dist/Windows-x86_64 dist/Windows-arm64


.FORCE:
2 changes: 1 addition & 1 deletion about.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<section>
<h1 id="about-this-software">About this software</h1>
<h2 id="datatools-1.2.11">datatools 1.2.11</h2>
<h2 id="datatools-1.2.12">datatools 1.2.12</h2>
<h3 id="authors">Authors</h3>
<ul>
<li>R. S. Doiel</li>
Expand Down
4 changes: 2 additions & 2 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors:
orcid: "https://orcid.org/0000-0003-0900-6903"

repository-code: "https://github.com/caltechlibrary/datatools"
version: 1.2.11
version: 1.2.12
license-url: "https://data.caltech.edu/license"
keywords: [ "csv", "excel", "sql", "json", "yaml", "xlsx", "golang", "bash" ]

Expand All @@ -20,7 +20,7 @@ keywords: [ "csv", "excel", "sql", "json", "yaml", "xlsx", "golang", "bash" ]
About this software
===================

## datatools 1.2.11
## datatools 1.2.12

### Authors

Expand Down
8 changes: 4 additions & 4 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"license": "https://data.caltech.edu/license",
"codeRepository": "https://github.com/caltechlibrary/datatools",
"dateCreated": "2017-02-06",
"dateRelease": "2024-10-24",
"dateModified": "2024-10-24",
"dateRelease": "2024-11-07",
"dateModified": "2024-11-07",
"downloadUrl": "https://github.com/caltechlibrary/datatools/releases/",
"issueTracker": "https://github.com/caltechlibrary/datatools/issues",
"name": "datatools",
"version": "1.2.11",
"version": "1.2.12",
"description": "A set of command line tools for working with CSV, Excel Workbooks, JSON and structured text documents.",
"releaseNotes": "fix isssue#21, CopyrightYear is an int",
"releaseNotes": "fix issue #22, identifying DOI without http prefix",
"applicationCategory": "computer programming",
"developmentStatus": "active",
"funder": {
Expand Down
15 changes: 14 additions & 1 deletion codemeta/codemeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (

// Caltech Library package
"github.com/caltechlibrary/doitools"

// 3rd Party Package
"github.com/hscells/doi"
)

type PersonOrOrganization struct {
Expand Down Expand Up @@ -53,6 +56,7 @@ type Codemeta struct {
// Additional codemeta Terms are defined at https://codemeta.github.io/terms/
}


func (person *PersonOrOrganization) ToJSON() ([]byte, error) {
return JSONMarshalIndent(person, "", "\t")
}
Expand All @@ -71,6 +75,15 @@ func (person *PersonOrOrganization) ToCFF() ([]byte, error) {
orcid: %s`, person.FamilyName, person.GivenName, person.Id)), nil
}

// Check if identifier is a DOI
func isDOI(identifier string) bool {
doi, err := doi.Parse(identifier)
if err != nil {
return false
}
return doi.IsValid()
}

// ToCff crosswalks a Codemeta data structure rendering
// CITATION.cff document as an array of byte.
// Based on documentation at https://citation-file-format.github.io/
Expand All @@ -96,7 +109,7 @@ repository-code: %q`, cm.CodeRepository))...)
src = append(src, []byte(`
type: software`)...)
}
if strings.HasPrefix(cm.Identifier, "https://doi.org/") {
if isDOI(cm.Identifier) {
if doi, err := doitools.NormalizeDOI(cm.Identifier); err == nil {
src = append(src, []byte(fmt.Sprintf(`
doi: %s`, doi))...)
Expand Down
17 changes: 17 additions & 0 deletions codemeta/codemeta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ import (
"testing"
)

func TestIsDOI(t *testing.T) {
identifier := "10.22002/5rbqw-9cc91"
expected := true
got := isDOI(identifier)
if expected != got {
t.Errorf("for %q, expected %t, got %t", identifier, expected, got)
}
identifier = "0000-1111-2222-3333"
expected = false
got = isDOI(identifier)
if expected != got {
t.Errorf("for %q, expected %t, got %t", identifier, expected, got)
}


}

func TestCodemeta(t *testing.T) {
t.Errorf("TestCodemeta() not implemented.")
}
Expand Down
4 changes: 2 additions & 2 deletions codemeta2cff.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%codemeta2cff(1) user manual | version 1.2.11 ff4493f
%codemeta2cff(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down
4 changes: 2 additions & 2 deletions csv2json.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csv2json(1) user manual | version 1.2.11 ff4493f
%csv2json(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down
2 changes: 1 addition & 1 deletion csv2mdtable.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ <h1 id="examples">EXAMPLES</h1>
<pre><code> cat data1.csv | csv2mdtable &gt; data1.md</code></pre>
<p>Convert data1.csv to data1.md using options.</p>
<pre><code> csv2mdtable -i data1.csv -o data1.md</code></pre>
<p>csv2mdtable 1.2.11</p>
<p>csv2mdtable 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions csv2mdtable.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csv2mdtable(1) user manual | version 1.2.11 ff4493f
%csv2mdtable(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -62,6 +62,6 @@ Convert data1.csv to data1.md using options.
csv2mdtable -i data1.csv -o data1.md
~~~

csv2mdtable 1.2.11
csv2mdtable 1.2.12


2 changes: 1 addition & 1 deletion csv2tab.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1 id="examples">EXAMPLES</h1>
<p>This would yield</p>
<pre><code> name email age
Doe, Jane [email protected] 42</code></pre>
<p>csv2tab 1.2.11</p>
<p>csv2tab 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions csv2tab.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csv2tab(1) user manual | version 1.2.11 ff4493f
%csv2tab(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -49,6 +49,6 @@ This would yield
Doe, Jane [email protected] 42
~~~

csv2tab 1.2.11
csv2tab 1.2.12


2 changes: 1 addition & 1 deletion csv2xlsx.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h1 id="examples">EXAMPLES</h1>
<pre><code> cat data.csv | csv2xlsx MyWorkbook.xlsx &#39;My worksheet 2&#39;</code></pre>
<p>This does the same but the contents of data.csv are piped into the
workbook’s ‘My worksheet 2’ sheet.</p>
<p>csv2xlsx 1.2.11</p>
<p>csv2xlsx 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions csv2xlsx.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csv2xlsx(1) user manual | version 1.2.11 ff4493f
%csv2xlsx(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -69,6 +69,6 @@ called 'MyWorkbook.xlsx' with the contents of data.csv.
This does the same but the contents of data.csv are piped into
the workbook's 'My worksheet 2' sheet.

csv2xlsx 1.2.11
csv2xlsx 1.2.12


2 changes: 1 addition & 1 deletion csvcleaner.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h1 id="examples">EXAMPLES</h1>
<pre><code> cat mysheet.csv | csvcleaner -right-trim</code></pre>
<p>Trim leading and trailing spaces from output.</p>
<pre><code> cat mysheet.csv | csvcleaner -trim-space</code></pre>
<p>csvcleaner 1.2.11</p>
<p>csvcleaner 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions csvcleaner.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csvcleaner(1) user manual | version 1.2.11 ff4493f
%csvcleaner(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -107,5 +107,5 @@ Trim leading and trailing spaces from output.
cat mysheet.csv | csvcleaner -trim-space
~~~

csvcleaner 1.2.11
csvcleaner 1.2.12

2 changes: 1 addition & 1 deletion csvcols.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ <h1 id="examples">EXAMPLES</h1>
<p>Using options filter a 3 column CSV file for columns 1,3 into
2col.csv</p>
<pre><code> csvcols -i 3col.csv -col 1,3 -o 2col.csv</code></pre>
<p>csvcols 1.2.11</p>
<p>csvcols 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions csvcols.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csvcols(1) user manual | version 1.2.11 ff4493f
%csvcols(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -90,6 +90,6 @@ Using options filter a 3 column CSV file for columns 1,3 into 2col.csv
csvcols -i 3col.csv -col 1,3 -o 2col.csv
~~~

csvcols 1.2.11
csvcols 1.2.12


2 changes: 1 addition & 1 deletion csvfind.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ <h1 id="examples">EXAMPLES</h1>
matches are.</p>
<p>You can also search for phrases in columns.</p>
<pre><code> csvfind -i books.csv -col=2 -contains &quot;Red Book&quot;</code></pre>
<p>csvfind 1.2.11</p>
<p>csvfind 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions csvfind.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csvfind(1) user manual | version 1.2.11 ff4493f
%csvfind(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -117,5 +117,5 @@ You can also search for phrases in columns.
csvfind -i books.csv -col=2 -contains "Red Book"
~~~

csvfind 1.2.11
csvfind 1.2.12

2 changes: 1 addition & 1 deletion csvjoin.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ <h1 id="examples">EXAMPLES</h1>
<pre><code> csvjoin -csv1=data1.csv -col1=2 \
-csv2=data2.csv -col2=4 \
-output=merged-data.csv</code></pre>
<p>csvjoin 1.2.11</p>
<p>csvjoin 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions csvjoin.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csvjoin(1) user manual | version 1.2.11 ff4493f
%csvjoin(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -105,6 +105,6 @@ merged-data.csv..
-output=merged-data.csv
~~~

csvjoin 1.2.11
csvjoin 1.2.12


2 changes: 1 addition & 1 deletion csvrows.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h1 id="examples">EXAMPLES</h1>
<p>Filter 3 randomly selected rows from 10row.csv rendering new CSV with
a header row from 10row.csv.</p>
<pre><code> csvrows -i 10row.csv -header=true -random=3</code></pre>
<p>csvrows 1.2.11</p>
<p>csvrows 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions csvrows.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%csvrows(1) user manual | version 1.2.11 ff4493f
%csvrows(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -96,6 +96,6 @@ a header row from 10row.csv.
csvrows -i 10row.csv -header=true -random=3
~~~

csvrows 1.2.11
csvrows 1.2.12


2 changes: 1 addition & 1 deletion finddir.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h1 id="options">OPTIONS</h1>
<h1 id="examples">EXAMPLES</h1>
<p>Find all subdirectories starting with “img”.</p>
<pre><code> finddir -p img</code></pre>
<p>finddir 1.2.11</p>
<p>finddir 1.2.12</p>
</section>

<footer>
Expand Down
6 changes: 3 additions & 3 deletions finddir.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%finddir(1) user manual | version 1.2.11 ff4493f
%finddir(1) user manual | version 1.2.12 1128bff
% R. S. Doiel
% 2024-10-24
% 2024-11-07

# NAME

Expand Down Expand Up @@ -65,5 +65,5 @@ Find all subdirectories starting with "img".
finddir -p img
~~~

finddir 1.2.11
finddir 1.2.12

Loading

0 comments on commit f838334

Please sign in to comment.