unreleased-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/README.md CHANGED
@@ -57,7 +57,7 @@ Commands (type `help <command>` in the shell for the details of each one):
57
57
  - **Admin** (administrators only): `pending`, `proposals`, `comps`, `applications`, `cdn`, `inspect`, `approve`, `reject`, `reverse`, `users`, `sitebans`, `siteunban`
58
58
  - **Fun:** `neofetch`, `fortune`, `juicesay`, `matrix`, `visualizer`, `karaoke`, `wordle`, `heardle`
59
59
  - **Settings:** `set`, `settings`, `termtheme`
60
- - **Shell:** `source`, `alias`, `unalias`, `history`, `echo`, `watch`, `full`, `date`, `clear`, `exit`, `help`
60
+ - **Shell:** `source`, `alias`, `unalias`, `history`, `echo`, `watch`, `full`, `date`, `clear`, `reload`, `exit`, `help`
61
61
  - **Account:** `login`, `logout`, `whoami`, `version`
62
62
 
63
63
  Things that work the same as on the site:
@@ -154,6 +154,8 @@ Wordle and Heardle keep their progress, streaks and song lists in `~/.unreleased
154
154
 
155
155
  `full` asks the terminal window to go fullscreen, and to leave again. It sends the xterm request for that, which many terminals ignore (Windows Terminal does), so F11 is the fallback.
156
156
 
157
+ `reload` (or `restart`) closes the shell and starts a fresh one, so a version installed by `update` is the one that runs, and your settings and rc file are read again. It only works in the interactive shell, and music stops.
158
+
157
159
  ## Signing in
158
160
 
159
161
  You can browse the files without an account. To sign in:
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/main.ts
4
+ import { spawnSync } from "node:child_process";
4
5
  import { createInterface as createInterface2 } from "node:readline";
5
6
 
6
7
  // src/config.ts
@@ -82,7 +83,7 @@ function saveSettings(settings) {
82
83
 
83
84
  // src/api.ts
84
85
  var DEFAULT_API = "https://juicewrldapi.com/juicewrld";
85
- var VERSION = "0.1.6";
86
+ var VERSION = "0.1.7";
86
87
  function apiBase() {
87
88
  return (process.env.UNRELEASED_API || loadConfig().api || DEFAULT_API).replace(/\/+$/, "");
88
89
  }
@@ -5431,6 +5432,18 @@ ${color.dim(`local ${sh.localDir}`)}`)
5431
5432
  { name: "exit", aliases: ["quit"], group: "Shell", usage: "exit", description: "Leave the shell", run: (_arg, sh) => {
5432
5433
  sh.exiting = true;
5433
5434
  } },
5435
+ {
5436
+ name: "reload",
5437
+ aliases: ["restart"],
5438
+ group: "Shell",
5439
+ usage: "reload",
5440
+ description: "Restart the shell (picks up a new version after update, and re-reads your settings and rc file). Music stops",
5441
+ run: (_a, sh) => {
5442
+ if (!sh.player) fail("reload: only the interactive shell can restart");
5443
+ sh.reloading = true;
5444
+ sh.exiting = true;
5445
+ }
5446
+ },
5434
5447
  {
5435
5448
  name: "help",
5436
5449
  aliases: ["man"],
@@ -5573,6 +5586,8 @@ var Shell = class {
5573
5586
  history;
5574
5587
  aliases;
5575
5588
  exiting = false;
5589
+ /** Leaving to start the shell again (reload). */
5590
+ reloading = false;
5576
5591
  /** The music player; only the interactive shell has one (it stops with it). */
5577
5592
  player = null;
5578
5593
  errors = 0;
@@ -5925,6 +5940,7 @@ ${color.dim("(press Ctrl+C again or type exit to leave)")}
5925
5940
  if (shell.player?.current) process.stdout.write(color.dim("music stopped\n"));
5926
5941
  stopMusic();
5927
5942
  await Promise.race([flushPlays(), new Promise((resolve3) => setTimeout(resolve3, 4e3).unref())]);
5943
+ return shell.reloading;
5928
5944
  }
5929
5945
 
5930
5946
  // src/shims/localStorage.ts
@@ -6036,8 +6052,9 @@ async function main() {
6036
6052
  return 0;
6037
6053
  }
6038
6054
  if (args.length === 0 && process.stdin.isTTY) {
6039
- await startRepl();
6040
- return 0;
6055
+ if (!await startRepl()) return 0;
6056
+ const again = spawnSync(process.execPath, [...process.execArgv, process.argv[1]], { stdio: "inherit" });
6057
+ return again.status ?? 1;
6041
6058
  }
6042
6059
  const shell = new Shell(oneShotPrompter(), false);
6043
6060
  let interrupts = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unreleased-cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "The Unreleased site terminal as a command-line shell",
5
5
  "keywords": [
6
6
  "juice-wrld",