Skip to content

Commit

Permalink
feat(cli): Add support for --as to list command
Browse files Browse the repository at this point in the history
  • Loading branch information
rekmarks committed Apr 19, 2024
1 parent 38e61af commit aa0986c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/cli/src/commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import os from 'os';
import { E } from '@endo/far';
import { makeRefIterator } from '@endo/daemon';
import { withEndoHost } from '../context.js';
import { withEndoAgent } from '../context.js';

export const list = async ({ directoryPath, follow, json }) =>
withEndoHost({ os, process }, async ({ host: agent }) => {
export const list = async ({ directoryPath, follow, json, agentNames }) =>
withEndoAgent(agentNames, { os, process }, async ({ agent }) => {
if (directoryPath !== undefined) {
agent = E(agent).lookup(...directoryPath.split('.'));
}
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/src/endo.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,13 @@ export const main = async rawArgs => {
program
.command('list [directory]')
.description('show names known to the current or specified directory')
.option(...commonOptions.as)
.option('-f,--follow', 'Follow updates')
.option('-j,--json', 'JSON format output')
.action(async (directoryPath, cmd) => {
const { follow, json } = cmd.opts();
const { as: agentNames, follow, json } = cmd.opts();
const { list } = await import('./commands/list.js');
return list({ directoryPath, follow, json });
return list({ directoryPath, follow, json, agentNames });
});

program
Expand Down

0 comments on commit aa0986c

Please sign in to comment.