-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelptext.ts
189 lines (132 loc) · 4.94 KB
/
helptext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
export function fmtHelp(
txt: string,
appName: string,
version: string,
releaseDate: string,
releaseHash: string,
): string {
return txt.replaceAll("{app_name}", appName).replaceAll("{version}", version)
.replaceAll("{release_date}", releaseDate).replaceAll(
"{release_hash}",
releaseHash,
);
}
export const cmtHelpText =
`%{app_name}(1) user manual | version {version} {release_hash}
% R. S. Doiel
% {release_date}
# NAME
{app_name}
# SYNOPSIS
{app_name} INPUT_NAME [OPTIONS]
{app_name} INPUT_NAME [OUTPUT_NAME] [OPTIONS]
{app_name} INPUT_NAME [OUTPUT_NAME OUTPUT_NAME ...] [OPTIONS]
# DESCRIPTION
{app_name} provides tooling for working with CodeMeta objects
targeting your Python, Go, JavaScript or TypeScript build process.
{app_name} can be used to generate various code artifacts including the following.
- CITATION.cff
- about.md
- version.py, version.go, version.js or version.ts
# OPTIONS
Options come as the last parameter(s) on the command line.
-h, --help
: display help
-v, --version
: display version
-l, --license
: display license
-f, --format
: output format to use when piping the output to another programming.
-d, --deno
: update the deno.json file tasks based on output files requested.
# EXAMPLES
Here's an example of rendering ` + "`CITATION.cff`" + ` from a ` +
"`codemeta.json`" + ` file. The second version
shows how to use the format option.
~~~
{app_name} codemeta.json CITATION.cff
{app_name} codemeta.json --format=cff >CITATION.cff
~~~
Here's an example of rendering ` + "`version.ts`" + `, ` + "`version.py`" +
`, and ` + "`version.go`" + ` from ` + "`codemeta.json`" + ` file.
~~~
{app_name} codemeta.json version.ts
{app_name} codemeta.json version.py
{app_name} codemeta.json version.go
~~~
Here's an example of generating an "about.md" file from the CodeMeta file.
~~~
{app_name} codemeta.json about.md
~~~
You can also just stack the output files you need one after another.
This is an example of creating the files to bootstrap a TypeScript project.
~~~
{app_name} codemeta.json about.md CITATION.cff version.ts
~~~
The "--deno" option can trail the above command to update the deno.json file
with a set of tasks to update the files you have specified.
~~~
{app_name} codemeta.json about.md CITATION.cff version.ts --deno
~~~
This will create a "gen-code" task that will rebuild those files based on
the current contents of the CodeMeta file.
`;
export const cmeHelpText: string = `%{app_name}(1) user manual | version {version} {release_hash}
% R. S. Doiel
% {release_date}
# NAME
{app_name}
# SYNOPSIS
{app_name} CODEMETA_JSON [OPTION ...]
{app_name} CODEMETA_JSON ATTRIBUTE_NAME [ATTRIBUTE_NAME ...] [OPTION ...]
{app_name} CODEMETA_JSON ATTRIBUTE_NAME=ATTRIBUTE_VALUE [ATTRIBUTE_NAME=ATTRIBUTE_VALUE ...] [OPTION ...]
# DESCRIPTION
{app_name} is a CodeMeta file editing tool. When called with only the CODEMETA_JSON filename
it will read in the CodeMeta file, report any errors, extrapolate values if needed. It will
then display a pretty printed normalized version of your CodeMeta file.
{app_name} will also let you modify specific attributes in a CodeMeta file. It does this by
reading the CodeMeta file and prompting you to type in the value. If you use the editor
option it'll launch your editor use it to set the value saving changes are saved back to
the CodeMeta file.
For attributes like author, contributor, maintainer and keyword should be typed in using
YAML syntax. The YAML will be converted to JSON and used to update your CodeMeta file.
If you provide one or more attribute names the attributes will be available to edit in the order
you've requested them to be edited.
Two date fields are set if they are not previously set, "dateCreated" and "dateModified". The
"dateModified" is updated each time you change something in the CodeMeta file unless you explicitly
edit it.
For the simple fields like version, name, description, releaseNotes you can set their values
directly on the command line using an equal sign between the attribute name and the value. If
the value includes spaces you need to wrap them in quotes. See the EXAMPLE below.
# OPTION
-h, --help
: display help
-v, --version
: display version
-l, --license
: display license
-e, --editor
: use Micro Editor to edit attributes. Micro Editor is a cross platform
text editor available from <https://micro-editor.github.io/>.
# EXAMPLES
Create a new CodeMeta file. If no attribute names are included then you will
be prompt for each attribute.
~~~
{app_name} codemeta.json
~~~
Set the version number in your codemeta.json file and add/replace the `+"`.releaseNotes`"+`.
~~~
{app_name} codemeta.json version releaseNotes
~~~
Set the version number to "0.0.1" and release notes to "Initial Concept"
without being prompted.
~~~shell
{app_name} codemeta.json version=0.0.1 release='Initial Concept'
~~~
If Micro Editor is installed you can edit the decription in micro using the
"-e" option.
~~~shell
{app_name} codemeta.json description -e
~~~
`;