Skip to content

Commit

Permalink
chore: add list valaccounts flag (#129)
Browse files Browse the repository at this point in the history
* chore: add list valaccounts flag

* fix: lint
  • Loading branch information
troykessler authored Apr 3, 2024
1 parent 2d3e8dc commit 50320ae
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 @@ -360,4 +360,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 (const 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 50320ae

Please sign in to comment.