Skip to content

Commit

Permalink
feat(cli): add listApps to display all installed apps on device (Ledg…
Browse files Browse the repository at this point in the history
…erHQ#5349)

* feat(cli): add listApps to display all installed apps on device

* feat(cli): add listApps description and documentation
  • Loading branch information
aussedatlo authored Nov 7, 2023
1 parent 317685e commit 57497fb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-singers-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/live-cli": patch
---

add listApps command to display all installed apps on device
3 changes: 3 additions & 0 deletions apps/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ Usage: ledger-live i18n # Test e2e functionality for device localization s
-i, --install <String> : install a language pack by its id
-u, --uninstall <String> : uninstall a language pack by its id
Usage: ledger-live listApps # list all installed apps on the device
-d, --device <String> : provide a specific HID path of a device
Usage: ledger-live liveData # utility for Ledger Live app.json file
-d, --device <String> : provide a specific HID path of a device
--xpub <String> : use an xpub (alternatively to --device) [DEPRECATED: prefer use of id]
Expand Down
2 changes: 2 additions & 0 deletions apps/cli/src/commands-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import getBatteryStatus from "./commands/getBatteryStatus";
import getDeviceRunningMode from "./commands/getDeviceRunningMode";
import getTransactionStatus from "./commands/getTransactionStatus";
import i18n from "./commands/i18n";
import listApps from "./commands/listApps";
import liveData from "./commands/liveData";
import managerListApps from "./commands/managerListApps";
import portfolio from "./commands/portfolio";
Expand Down Expand Up @@ -96,6 +97,7 @@ export default {
getDeviceRunningMode,
getTransactionStatus,
i18n,
listApps,
liveData,
managerListApps,
portfolio,
Expand Down
21 changes: 21 additions & 0 deletions apps/cli/src/commands/listApps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { from, tap } from "rxjs";
import { withDevice } from "@ledgerhq/live-common/hw/deviceAccess";
import listApps from "@ledgerhq/live-common/hw/listApps";
import { deviceOpt } from "../scan";

export default {
description: "list all installed apps on the device",
args: [deviceOpt],
job: ({
device,
}: Partial<{
device: string;
}>) =>
withDevice(device || "")(t =>
from(listApps(t)).pipe(
tap(res => {
console.log(res);
}),
),
),
};

0 comments on commit 57497fb

Please sign in to comment.