@harborppm/cli 0.14.0 → 0.14.1
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/README.md +2 -2
- package/lib/cli.mjs +11 -8
- package/lib/update.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ The website has the commands too: turn on **Command line at the bottom** in your
|
|
|
61
61
|
|
|
62
62
|
## In your shell prompt
|
|
63
63
|
|
|
64
|
-
`harbor prompt` prints a few characters for your prompt: `⚓ 2 today · 1 late`, with late work in coral, and nothing at all when you're clear. It never waits on the network: it shows the counts it kept and fetches new ones in the background when they're more than five minutes old, or after you change a task. `harbor prompt --init zsh` (or `bash`, `fish`, `starship`) prints the lines to add to your shell's setup:
|
|
64
|
+
`harbor prompt` prints a few characters for your prompt: `⚓ 2 today · 1 late`, with late work in coral, and nothing at all when you're clear. It never waits on the network: it shows the counts it kept and fetches new ones in the background when they're more than five minutes old, or after you change a task. `harbor prompt --init zsh` (or `bash`, `fish`, `starship`) prints the lines to add to your shell's setup, so `harbor prompt --init starship >> ~/.config/starship.toml` does it in one go:
|
|
65
65
|
|
|
66
66
|
```zsh
|
|
67
67
|
# ~/.zshrc
|
|
@@ -71,7 +71,7 @@ RPROMPT='$(harbor prompt --shell zsh)'
|
|
|
71
71
|
|
|
72
72
|
## Staying up to date
|
|
73
73
|
|
|
74
|
-
npm doesn't update a global install by itself, so once a day `harbor` asks npm whether a newer version is out, alongside whatever command you ran, and says so in one line when there is (`npm install -g @harborppm/cli@latest` updates it). It says nothing in scripts, pipes or CI; set `HARBOR_NO_UPDATE_CHECK=1` (or `NO_UPDATE_NOTIFIER=1`) to turn it off.
|
|
74
|
+
npm doesn't update a global install by itself, so once a day `harbor` asks npm whether a newer version is out, alongside whatever command you ran, and says so in one line when there is (`npm install -g @harborppm/cli@latest --prefer-online` updates it). It says nothing in scripts, pipes or CI; set `HARBOR_NO_UPDATE_CHECK=1` (or `NO_UPDATE_NOTIFIER=1`) to turn it off.
|
|
75
75
|
|
|
76
76
|
## Text from others
|
|
77
77
|
|
package/lib/cli.mjs
CHANGED
|
@@ -523,7 +523,8 @@ export async function run(argv, io = {}) {
|
|
|
523
523
|
const snippet = initSnippet(values.init);
|
|
524
524
|
if (!snippet) throw new HarborError(`Pick ${SHELLS.join(", ")} (not "${values.init}").`);
|
|
525
525
|
out(
|
|
526
|
-
|
|
526
|
+
// Comments, so the whole of it can be appended straight to the file.
|
|
527
|
+
`${snippet}\n# Shows what's due today and late, from the prompt after next;\n# nothing when you're clear. harbor prompt --refresh checks now.`,
|
|
527
528
|
);
|
|
528
529
|
return 0;
|
|
529
530
|
}
|
|
@@ -533,12 +534,14 @@ export async function run(argv, io = {}) {
|
|
|
533
534
|
const creds = await readCredentials(env);
|
|
534
535
|
const harbor = values.harbor ?? creds?.harbor ?? null;
|
|
535
536
|
const today = todayLocal(io.now ? new Date(io.now()) : new Date());
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
);
|
|
537
|
+
// A prompt with nothing to say gets nothing, not an empty line; a
|
|
538
|
+
// --refresh run by hand says what it found.
|
|
539
|
+
const show = (counts, at, byHand = false) => {
|
|
540
|
+
if (values.json) return out(jsonText({ ...(counts ?? { today: null, late: null }), at }));
|
|
541
|
+
const text = segment(counts ?? {}, shell);
|
|
542
|
+
if (text) out(text);
|
|
543
|
+
else if (byHand) out("Nothing due today or late.");
|
|
544
|
+
};
|
|
542
545
|
if (!creds) {
|
|
543
546
|
if (values.refresh) throw new HarborError("Not signed in. Run harbor login.");
|
|
544
547
|
show(null, null);
|
|
@@ -553,7 +556,7 @@ export async function run(argv, io = {}) {
|
|
|
553
556
|
const counts = promptCounts(work, today);
|
|
554
557
|
const at = io.now?.() ?? Date.now();
|
|
555
558
|
await writePromptCache({ at, day: today, harbor, counts }, env);
|
|
556
|
-
show(counts, at);
|
|
559
|
+
show(counts, at, !shell);
|
|
557
560
|
return 0;
|
|
558
561
|
}
|
|
559
562
|
// The prompt itself: what's kept, at once, and fresh counts fetched for next time.
|
package/lib/update.mjs
CHANGED
|
@@ -68,6 +68,6 @@ export async function updateNotice({
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
return latest && isNewer(latest, version)
|
|
71
|
-
? `Harbor CLI ${latest} is out (you have ${version}): npm install -g @harborppm/cli@latest`
|
|
71
|
+
? `Harbor CLI ${latest} is out (you have ${version}): npm install -g @harborppm/cli@latest --prefer-online`
|
|
72
72
|
: null;
|
|
73
73
|
}
|