Skip to content

Commit

Permalink
chore: add list valaccounts flag
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Apr 3, 2024
1 parent 38ea7c7 commit bcaebd4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tools/kysor/src/commands/valaccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,24 @@ valaccounts
}
});

valaccounts
.command("list")
.description("List all valaccounts")
.option(
"--home <string>",
"The location of the .kysor home directory where binaries and configs are stored."
)
.action(async (options) => {
try {
const home = path.join(options.home || USER_HOME, KYSOR_DIR);

const files = fs.readdirSync(path.join(home, "valaccounts"));
for (let file of files) {
console.log(file.replace(".toml", ""));
}
} catch (err) {
console.log(`ERROR: Could not list valaccounts: ${err}`);
}
});

export default valaccounts;

0 comments on commit bcaebd4

Please sign in to comment.