@barmark/cli 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/README.md +3 -2
- package/dist/help.js +9 -0
- package/dist/main.js +2 -1
- package/dist/part.js +29 -0
- package/dist/render.js +9 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,21 @@ package uses [semantic versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.7] - 2026-11-03
|
|
10
|
+
|
|
11
|
+
Uses `barmark` 0.14.0 and `@barmark/render` 0.11.0, pinned exactly:
|
|
12
|
+
charts may carry several parts, written as systems (barmark's grammar
|
|
13
|
+
7.4), and `render` draws them.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`barmark part <label> <file>`** prints one part of a chart of several
|
|
18
|
+
(barmark's grammar 7.4) as a chart of its own: its own bars, the tutti
|
|
19
|
+
bars, and N.C. where it rests. The part's problems go to stderr, as
|
|
20
|
+
`transpose`'s do; an error, or an undeclared label, exits 1, and
|
|
21
|
+
`--out` is not written from a chart with errors.
|
|
22
|
+
- **`render --part <label>`** draws only that part.
|
|
23
|
+
|
|
9
24
|
## [0.1.6] - 2026-11-03
|
|
10
25
|
|
|
11
26
|
Uses `barmark` 0.13.0 and `@barmark/render` 0.10.0, pinned exactly:
|
|
@@ -64,7 +79,8 @@ The first release of the `barmark` command. Uses `barmark` 0.8.0 and
|
|
|
64
79
|
- **The `barmark` command:** `check`, `format`, `render` and `transpose`
|
|
65
80
|
for `.chart.md` files, on npm and as standalone binaries.
|
|
66
81
|
|
|
67
|
-
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/cli-v0.1.
|
|
82
|
+
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/cli-v0.1.7...HEAD
|
|
83
|
+
[0.1.7]: https://github.com/kevinpeckham/barmark/compare/cli-v0.1.6...cli-v0.1.7
|
|
68
84
|
[0.1.6]: https://github.com/kevinpeckham/barmark/compare/cli-v0.1.5...cli-v0.1.6
|
|
69
85
|
[0.1.5]: https://github.com/kevinpeckham/barmark/compare/cli-v0.1.4...cli-v0.1.5
|
|
70
86
|
[0.1.4]: https://github.com/kevinpeckham/barmark/compare/cli-v0.1.3...cli-v0.1.4
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @barmark/cli
|
|
2
2
|
|
|
3
|
-
The `barmark` command: check, format, render and transpose
|
|
3
|
+
The `barmark` command: check, format, part, render and transpose
|
|
4
4
|
[Barmark](https://www.barmark.dev) chord charts (`.chart.md` files) in a
|
|
5
5
|
terminal or in CI. It runs the same `barmark` parser and `@barmark/render`
|
|
6
6
|
renderer as barmark.dev, at exact versions, so a chart means the same
|
|
@@ -37,6 +37,7 @@ barmark check --strict --format github songs # warnings fail too; PR annotatio
|
|
|
37
37
|
barmark format song.chart.md # print it in standard form
|
|
38
38
|
barmark format --write songs # rewrite the files that change
|
|
39
39
|
barmark format --check songs # list them and fail, for CI
|
|
40
|
+
barmark part Bass song.chart.md # one part of a chart of several
|
|
40
41
|
barmark render song.chart.md --out song.html # a standalone page, font included
|
|
41
42
|
barmark transpose song.chart.md --to E # or --semitones -2
|
|
42
43
|
```
|
|
@@ -44,7 +45,7 @@ barmark transpose song.chart.md --to E # or --semitones -2
|
|
|
44
45
|
`check --format json` prints the diagnostics for other tools. `render`
|
|
45
46
|
takes the renderer's options as flags: `--theme auto|light|dark`,
|
|
46
47
|
`--numerals nashville|roman`, `--no-bar-numbers`, `--rehearsal-letters`,
|
|
47
|
-
`--no-wrap`, `--diagnostics`, and `--font-url <url>` to link the font
|
|
48
|
+
`--no-wrap`, `--diagnostics`, `--part <label>` to draw one part, and `--font-url <url>` to link the font
|
|
48
49
|
instead of embedding it. `barmark <command> --help` lists each command's
|
|
49
50
|
flags; `barmark --version` prints the versions of the CLI and both
|
|
50
51
|
libraries.
|
package/dist/help.js
CHANGED
|
@@ -4,6 +4,7 @@ export const HELP = `Usage: barmark <command> [options]
|
|
|
4
4
|
Commands:
|
|
5
5
|
check <paths…> Report each chart's errors and warnings
|
|
6
6
|
format <paths…> Print or rewrite charts in standard form
|
|
7
|
+
part <label> <file> Print one part of a chart of several
|
|
7
8
|
render <file> Write a chart as a standalone HTML page
|
|
8
9
|
transpose <file> Print a chart in another key
|
|
9
10
|
|
|
@@ -44,8 +45,16 @@ A standalone HTML page of the chart, with the Edwin font embedded.
|
|
|
44
45
|
--no-bar-numbers Hide bar numbers
|
|
45
46
|
--rehearsal-letters Letter each section A, B, C…
|
|
46
47
|
--no-wrap Keep each row on one line
|
|
48
|
+
--part <label> Draw only this part
|
|
47
49
|
--diagnostics List the chart's problems below it
|
|
48
50
|
--font-url <url> Link the font instead of embedding it
|
|
51
|
+
`,
|
|
52
|
+
part: `Usage: barmark part <label> <file> [options]
|
|
53
|
+
|
|
54
|
+
One part of a chart of several, as a chart of its own: its own bars, the
|
|
55
|
+
bars every part plays, and N.C. where it rests. Problems go to stderr.
|
|
56
|
+
|
|
57
|
+
--out <file> Write to a file instead of stdout
|
|
49
58
|
`,
|
|
50
59
|
transpose: `Usage: barmark transpose <file> (--to <key> | --semitones <n>) [options]
|
|
51
60
|
|
package/dist/main.js
CHANGED
|
@@ -3,10 +3,11 @@ import { check } from "./check.js";
|
|
|
3
3
|
import { format } from "./format.js";
|
|
4
4
|
import { COMMAND_HELP, HELP } from "./help.js";
|
|
5
5
|
import { UsageError } from "./io.js";
|
|
6
|
+
import { part } from "./part.js";
|
|
6
7
|
import { render } from "./render.js";
|
|
7
8
|
import { transpose } from "./transpose.js";
|
|
8
9
|
/** Each subcommand by name. */
|
|
9
|
-
export const COMMANDS = { check, format, render, transpose };
|
|
10
|
+
export const COMMANDS = { check, format, part, render, transpose };
|
|
10
11
|
export async function main(argv, io) {
|
|
11
12
|
const [name, ...args] = argv;
|
|
12
13
|
if (name === "--version" || name === "-v") {
|
package/dist/part.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** barmark part: one part of a chart of several, as a chart of its own. */
|
|
2
|
+
import { extractPart, printPart } from "barmark";
|
|
3
|
+
import { parseFlags } from "./args.js";
|
|
4
|
+
import { readCharts } from "./inputs.js";
|
|
5
|
+
import { UsageError } from "./io.js";
|
|
6
|
+
import { onlyChart, writeOutput } from "./output.js";
|
|
7
|
+
import { textLine } from "./report.js";
|
|
8
|
+
export async function part(args, io) {
|
|
9
|
+
const { values, positionals } = parseFlags(args, { out: { type: "string" } });
|
|
10
|
+
const [label, ...paths] = positionals;
|
|
11
|
+
if (label === undefined)
|
|
12
|
+
throw new UsageError("give a part's label, then a chart");
|
|
13
|
+
const { path, text } = onlyChart(await readCharts(paths, io, { folders: false }), "part");
|
|
14
|
+
const parse = extractPart(text, label);
|
|
15
|
+
const printed = printPart(text, label);
|
|
16
|
+
if (parse === null || printed === null) {
|
|
17
|
+
io.stderr(`${path}: no part labelled ${label}\n`);
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
// As transpose does: the part's problems to stderr, and no file written from a chart with errors.
|
|
21
|
+
for (const d of parse.diagnostics)
|
|
22
|
+
io.stderr(`${textLine(path, d)}\n`);
|
|
23
|
+
const failed = parse.diagnostics.some((d) => d.severity === "error");
|
|
24
|
+
if (failed && values.out !== undefined)
|
|
25
|
+
io.stderr(`${values.out} not written: the chart has errors\n`);
|
|
26
|
+
else
|
|
27
|
+
writeOutput(printed, values.out, io);
|
|
28
|
+
return failed ? 1 : 0;
|
|
29
|
+
}
|
package/dist/render.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** barmark render: a chart as a standalone HTML page, with Edwin embedded unless linked. */
|
|
2
2
|
import { basename } from "node:path";
|
|
3
3
|
import { renderChart } from "@barmark/render";
|
|
4
|
-
import { parseChart } from "barmark";
|
|
4
|
+
import { extractPart, parseChart } from "barmark";
|
|
5
5
|
import { oneOf, parseFlags } from "./args.js";
|
|
6
6
|
import { readCharts } from "./inputs.js";
|
|
7
7
|
import { onlyChart, writeOutput } from "./output.js";
|
|
@@ -32,6 +32,7 @@ export async function render(args, io) {
|
|
|
32
32
|
"no-wrap": { type: "boolean", default: false },
|
|
33
33
|
diagnostics: { type: "boolean", default: false },
|
|
34
34
|
"font-url": { type: "string" },
|
|
35
|
+
part: { type: "string" },
|
|
35
36
|
});
|
|
36
37
|
const options = {
|
|
37
38
|
fontUrl: values["font-url"] ?? `data:font/otf;base64,${Buffer.from(io.font()).toString("base64")}`,
|
|
@@ -50,6 +51,13 @@ export async function render(args, io) {
|
|
|
50
51
|
if (values.diagnostics)
|
|
51
52
|
options.diagnostics = true;
|
|
52
53
|
const { path, text } = onlyChart(await readCharts(positionals, io, { folders: false }), "render");
|
|
54
|
+
if (values.part !== undefined) {
|
|
55
|
+
if (!extractPart(text, values.part)) {
|
|
56
|
+
io.stderr(`${path}: no part labelled ${values.part}\n`);
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
options.part = values.part;
|
|
60
|
+
}
|
|
53
61
|
const title = parseChart(text).title ?? basename(path).replace(/\.chart\.md$|\.md$/, "");
|
|
54
62
|
writeOutput(htmlDocument(title, renderChart(text, options)), values.out, io);
|
|
55
63
|
return 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barmark/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "The barmark command: check, format, render and transpose barmark chord charts (.chart.md) from the terminal and in CI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"url": "https://github.com/kevinpeckham/barmark/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"barmark": "0.
|
|
41
|
-
"@barmark/render": "0.
|
|
40
|
+
"barmark": "0.14.0",
|
|
41
|
+
"@barmark/render": "0.11.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|