@userland.fun/cli 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,6 +9,9 @@ const KEYCHAIN_SERVICE = "fun.userland.cli";
9
9
  const KEYCHAIN_ACCOUNT = "default";
10
10
  async function main() {
11
11
  const [command, ...args] = process.argv.slice(2);
12
+ if (isHelpCommand(command)) {
13
+ usage(0);
14
+ }
12
15
  if (command === "apps") {
13
16
  await appsCommand(args);
14
17
  return;
@@ -970,8 +973,12 @@ function errorMessage(body) {
970
973
  }
971
974
  return message ?? code;
972
975
  }
976
+ function isHelpCommand(command) {
977
+ return command === "--help" || command === "-h" || command === "help";
978
+ }
973
979
  function usage(exitCode) {
974
- console.error(`Usage:
980
+ const message = `Usage:
981
+ userland [--help]
975
982
  userland signup [--username <username>] [--password <password>] [--email <email>] [--no-save]
976
983
  userland login [--username <username>] [--password <password>] [--no-save]
977
984
  userland auth status
@@ -998,7 +1005,13 @@ Credentials:
998
1005
 
999
1006
  Docs:
1000
1007
  https://docs.userland.fun/reference/cli
1001
- https://docs.userland.fun/guides/troubleshooting`);
1008
+ https://docs.userland.fun/guides/troubleshooting`;
1009
+ if (exitCode === 0) {
1010
+ console.log(message);
1011
+ }
1012
+ else {
1013
+ console.error(message);
1014
+ }
1002
1015
  process.exit(exitCode);
1003
1016
  }
1004
1017
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@userland.fun/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Userland command-line tools for publishing and operating apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",