@bitsocial/bitsocial-cli 0.19.40 → 0.19.41

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
@@ -304,7 +304,7 @@ $ bitsocial community edit mysub.bso '--roles["author-address.bso"]' null
304
304
  * [`bitsocial community create`](#bitsocial-community-create)
305
305
  * [`bitsocial community delete ADDRESSES`](#bitsocial-community-delete-addresses)
306
306
  * [`bitsocial community edit ADDRESS`](#bitsocial-community-edit-address)
307
- * [`bitsocial community get ADDRESS`](#bitsocial-community-get-address)
307
+ * [`bitsocial community get [ADDRESS]`](#bitsocial-community-get-address)
308
308
  * [`bitsocial community list`](#bitsocial-community-list)
309
309
  * [`bitsocial community start ADDRESSES`](#bitsocial-community-start-addresses)
310
310
  * [`bitsocial community stop ADDRESSES`](#bitsocial-community-stop-addresses)
@@ -344,7 +344,7 @@ EXAMPLES
344
344
  $ bitsocial challenge install ./my-local-challenge
345
345
  ```
346
346
 
347
- _See code: [src/cli/commands/challenge/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/challenge/install.ts)_
347
+ _See code: [src/cli/commands/challenge/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/challenge/install.ts)_
348
348
 
349
349
  ## `bitsocial challenge list`
350
350
 
@@ -367,7 +367,7 @@ EXAMPLES
367
367
  $ bitsocial challenge list -q
368
368
  ```
369
369
 
370
- _See code: [src/cli/commands/challenge/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/challenge/list.ts)_
370
+ _See code: [src/cli/commands/challenge/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/challenge/list.ts)_
371
371
 
372
372
  ## `bitsocial challenge remove NAME`
373
373
 
@@ -392,7 +392,7 @@ EXAMPLES
392
392
  $ bitsocial challenge remove @scope/my-challenge
393
393
  ```
394
394
 
395
- _See code: [src/cli/commands/challenge/remove.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/challenge/remove.ts)_
395
+ _See code: [src/cli/commands/challenge/remove.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/challenge/remove.ts)_
396
396
 
397
397
  ## `bitsocial community create`
398
398
 
@@ -417,7 +417,7 @@ EXAMPLES
417
417
  $ bitsocial community create --title 'Hello Plebs' --description 'Welcome'
418
418
  ```
419
419
 
420
- _See code: [src/cli/commands/community/create.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/community/create.ts)_
420
+ _See code: [src/cli/commands/community/create.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/create.ts)_
421
421
 
422
422
  ## `bitsocial community delete ADDRESSES`
423
423
 
@@ -442,7 +442,7 @@ EXAMPLES
442
442
  $ bitsocial community delete 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu
443
443
  ```
444
444
 
445
- _See code: [src/cli/commands/community/delete.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/community/delete.ts)_
445
+ _See code: [src/cli/commands/community/delete.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/delete.ts)_
446
446
 
447
447
  ## `bitsocial community edit ADDRESS`
448
448
 
@@ -494,21 +494,23 @@ EXAMPLES
494
494
  $ bitsocial community edit plebbit.bso --settings.fetchThumbnailUrls=false
495
495
  ```
496
496
 
497
- _See code: [src/cli/commands/community/edit.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/community/edit.ts)_
497
+ _See code: [src/cli/commands/community/edit.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/edit.ts)_
498
498
 
499
- ## `bitsocial community get ADDRESS`
499
+ ## `bitsocial community get [ADDRESS]`
500
500
 
501
501
  Fetch a local or remote community, and print its json in the terminal
502
502
 
503
503
  ```
504
504
  USAGE
505
- $ bitsocial community get ADDRESS --pkcRpcUrl <value>
505
+ $ bitsocial community get [ADDRESS] --pkcRpcUrl <value> [--name <value>] [--publicKey <value>]
506
506
 
507
507
  ARGUMENTS
508
- ADDRESS Address of the community to fetch
508
+ [ADDRESS] Address of the community to fetch
509
509
 
510
510
  FLAGS
511
+ --name=<value> Name of the community to fetch
511
512
  --pkcRpcUrl=<value> (required) [default: ws://localhost:9138/] URL to PKC RPC
513
+ --publicKey=<value> Public key of the community to fetch
512
514
 
513
515
  DESCRIPTION
514
516
  Fetch a local or remote community, and print its json in the terminal
@@ -517,9 +519,13 @@ EXAMPLES
517
519
  $ bitsocial community get plebmusic.bso
518
520
 
519
521
  $ bitsocial community get 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu
522
+
523
+ $ bitsocial community get --name my-community
524
+
525
+ $ bitsocial community get --publicKey 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu
520
526
  ```
521
527
 
522
- _See code: [src/cli/commands/community/get.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/community/get.ts)_
528
+ _See code: [src/cli/commands/community/get.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/get.ts)_
523
529
 
524
530
  ## `bitsocial community list`
525
531
 
@@ -542,7 +548,7 @@ EXAMPLES
542
548
  $ bitsocial community list
543
549
  ```
544
550
 
545
- _See code: [src/cli/commands/community/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/community/list.ts)_
551
+ _See code: [src/cli/commands/community/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/list.ts)_
546
552
 
547
553
  ## `bitsocial community start ADDRESSES`
548
554
 
@@ -571,7 +577,7 @@ EXAMPLES
571
577
  $ bitsocial community start $(bitsocial community list -q)
572
578
  ```
573
579
 
574
- _See code: [src/cli/commands/community/start.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/community/start.ts)_
580
+ _See code: [src/cli/commands/community/start.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/start.ts)_
575
581
 
576
582
  ## `bitsocial community stop ADDRESSES`
577
583
 
@@ -596,7 +602,7 @@ EXAMPLES
596
602
  $ bitsocial community stop Qmb99crTbSUfKXamXwZBe829Vf6w5w5TktPkb6WstC9RFW
597
603
  ```
598
604
 
599
- _See code: [src/cli/commands/community/stop.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/community/stop.ts)_
605
+ _See code: [src/cli/commands/community/stop.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/stop.ts)_
600
606
 
601
607
  ## `bitsocial daemon`
602
608
 
@@ -638,7 +644,7 @@ EXAMPLES
638
644
  $ bitsocial daemon --chainProviderUrls viem --chainProviderUrls https://mainnet.infura.io/v3/YOUR_KEY
639
645
  ```
640
646
 
641
- _See code: [src/cli/commands/daemon.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/daemon.ts)_
647
+ _See code: [src/cli/commands/daemon.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/daemon.ts)_
642
648
 
643
649
  ## `bitsocial help [COMMAND]`
644
650
 
@@ -695,7 +701,7 @@ EXAMPLES
695
701
  $ bitsocial logs --since 1h -f
696
702
  ```
697
703
 
698
- _See code: [src/cli/commands/logs.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/logs.ts)_
704
+ _See code: [src/cli/commands/logs.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/logs.ts)_
699
705
 
700
706
  ## `bitsocial update check`
701
707
 
@@ -712,7 +718,7 @@ EXAMPLES
712
718
  $ bitsocial update check
713
719
  ```
714
720
 
715
- _See code: [src/cli/commands/update/check.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/update/check.ts)_
721
+ _See code: [src/cli/commands/update/check.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/update/check.ts)_
716
722
 
717
723
  ## `bitsocial update install [VERSION]`
718
724
 
@@ -741,7 +747,7 @@ EXAMPLES
741
747
  $ bitsocial update install --force
742
748
  ```
743
749
 
744
- _See code: [src/cli/commands/update/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/update/install.ts)_
750
+ _See code: [src/cli/commands/update/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/update/install.ts)_
745
751
 
746
752
  ## `bitsocial update versions`
747
753
 
@@ -763,7 +769,7 @@ EXAMPLES
763
769
  $ bitsocial update versions --limit 5
764
770
  ```
765
771
 
766
- _See code: [src/cli/commands/update/versions.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.40/src/cli/commands/update/versions.ts)_
772
+ _See code: [src/cli/commands/update/versions.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/update/versions.ts)_
767
773
  <!-- commandsstop -->
768
774
 
769
775
  ## Contribution
@@ -3,7 +3,11 @@ export default class Get extends BaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static args: {
6
- address: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ address: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ publicKey: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
11
  };
8
12
  run(): Promise<void>;
9
13
  }
@@ -1,24 +1,44 @@
1
- import { Args } from "@oclif/core";
1
+ import { Args, Flags } from "@oclif/core";
2
2
  import { BaseCommand } from "../../base-command.js";
3
3
  import * as remeda from "remeda";
4
4
  export default class Get extends BaseCommand {
5
5
  static description = "Fetch a local or remote community, and print its json in the terminal";
6
6
  static examples = [
7
7
  "bitsocial community get plebmusic.bso",
8
- "bitsocial community get 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu"
8
+ "bitsocial community get 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu",
9
+ "bitsocial community get --name my-community",
10
+ "bitsocial community get --publicKey 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu"
9
11
  ];
10
12
  static args = {
11
13
  address: Args.string({
12
14
  name: "address",
13
- required: true,
15
+ required: false,
14
16
  description: "Address of the community to fetch"
15
17
  })
16
18
  };
19
+ static flags = {
20
+ name: Flags.string({
21
+ description: "Name of the community to fetch"
22
+ }),
23
+ publicKey: Flags.string({
24
+ description: "Public key of the community to fetch"
25
+ })
26
+ };
17
27
  async run() {
18
28
  const { args, flags } = await this.parse(Get);
29
+ const lookupParam = {};
30
+ if (args.address)
31
+ lookupParam.address = args.address;
32
+ if (flags.name)
33
+ lookupParam.name = flags.name;
34
+ if (flags.publicKey)
35
+ lookupParam.publicKey = flags.publicKey;
36
+ if (Object.keys(lookupParam).length === 0) {
37
+ this.error("At least one of address argument, --name, or --publicKey must be provided");
38
+ }
19
39
  const pkc = await this._connectToPkcRpc(flags.pkcRpcUrl.toString());
20
40
  try {
21
- const community = await pkc.getCommunity({ address: args.address });
41
+ const community = await pkc.getCommunity(lookupParam);
22
42
  const communityJson = JSON.parse(JSON.stringify(community));
23
43
  this.logJson({ posts: communityJson.posts, ...remeda.omit(communityJson, ["posts"]) }); // make sure posts is printed first, because most users won't look at it
24
44
  }
@@ -417,13 +417,15 @@
417
417
  "address": {
418
418
  "description": "Address of the community to fetch",
419
419
  "name": "address",
420
- "required": true
420
+ "required": false
421
421
  }
422
422
  },
423
423
  "description": "Fetch a local or remote community, and print its json in the terminal",
424
424
  "examples": [
425
425
  "bitsocial community get plebmusic.bso",
426
- "bitsocial community get 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu"
426
+ "bitsocial community get 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu",
427
+ "bitsocial community get --name my-community",
428
+ "bitsocial community get --publicKey 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu"
427
429
  ],
428
430
  "flags": {
429
431
  "pkcRpcUrl": {
@@ -434,6 +436,20 @@
434
436
  "hasDynamicHelp": false,
435
437
  "multiple": false,
436
438
  "type": "option"
439
+ },
440
+ "name": {
441
+ "description": "Name of the community to fetch",
442
+ "name": "name",
443
+ "hasDynamicHelp": false,
444
+ "multiple": false,
445
+ "type": "option"
446
+ },
447
+ "publicKey": {
448
+ "description": "Public key of the community to fetch",
449
+ "name": "publicKey",
450
+ "hasDynamicHelp": false,
451
+ "multiple": false,
452
+ "type": "option"
437
453
  }
438
454
  },
439
455
  "hasDynamicHelp": false,
@@ -687,5 +703,5 @@
687
703
  ]
688
704
  }
689
705
  },
690
- "version": "0.19.40"
706
+ "version": "0.19.41"
691
707
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitsocial/bitsocial-cli",
3
- "version": "0.19.40",
3
+ "version": "0.19.41",
4
4
  "description": "Command line interface to Bitsocial API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "homepage": "https://github.com/bitsocialnet/bitsocial-cli",