Skip to content

Commit

Permalink
feat: adds status/account sub-command
Browse files Browse the repository at this point in the history
  • Loading branch information
Ephigenia committed Feb 14, 2022
1 parent d658a85 commit f8882c9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Command Line Interface ([CLI](https://en.wikipedia.org/wiki/Command-line_interfa
- [ ] different output when availableBalance doesn’t match balance
- [ ] add notification when card fraud is on
- [x] option to permanently set different LC_ALL
- [ ] status command returns current overall status
- [x] status command returns current overall status (`kontist-cli account`)
- [ ] validate IBAN (checksum)
- [ ] prevent invalid characters in purpose, e2eid
- [ ] add multiple output formats
- [ ] `--pretty` as table
- [ ] `--json` as json (default)
Expand Down
27 changes: 27 additions & 0 deletions source/cli-account.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env node
import { Command } from 'commander';

import { createDefaultClient } from './lib/client.js';
import config from './lib/config.js';
import { BIN_NAME } from './lib/constants.js';

// TODO filter for specific transactions, amount, incoming, outgoing?
const program = new Command();
program
.description(``)
.addHelpText(
'after',
`
Examples:
Lorem Ipusm
${BIN_NAME} status
`,
)
.action(run)
.parseAsync();

async function run() {
const client = await createDefaultClient(config);
const account = await client.models.account.get();
console.log(account);
}
1 change: 1 addition & 0 deletions source/cli-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ async function run(
}

const client = await createDefaultClient(config);

const confirmationId = await client.models.transfer.createOne(parameters);

// TODO add error handling when confirming the transfer
Expand Down
4 changes: 4 additions & 0 deletions source/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ program
.command('login', 'configuration of login & authorization', {
executableFile: 'cli-login',
})
.command('account', 'get account information', {
executableFile: 'cli-account',
})
.alias('status')
.command('subscribe', 'subscribe for new transactions', {
executableFile: 'cli-subscribe',
})
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compileOnSave": true,
"compilerOptions": {
"allowJs": true,
"declaration": true,
"declaration": false,
"target": "ES2015",
"module": "commonjs",
"esModuleInterop": true,
Expand Down

0 comments on commit f8882c9

Please sign in to comment.