| 7 | import type { CommonArgs } from '../../types/cli'; |
| 8 | |
| 9 | export function command(args: CommonArgs) { |
| 10 | const { wallet, program } = args; |
| 11 | program |
| 12 | .description('Export wallet to a file') |
| 13 | .usage('<walletName> --command export [options]') |
| 14 | .optionsGroup('Export Options') |
| 15 | .option('--filename <filename>', 'Filename to export to', `~/${wallet.name}-export.json`) |
| 16 | .option('--readonly', 'Export as read-only (cannot send funds)') |
| 17 | .parse(process.argv); |
| 18 | |
| 19 | const opts = program.opts(); |
| 20 | if (opts.help) { |
| 21 | program.help(); |
| 22 | } |
| 23 | return opts; |
| 24 | } |
| 25 | |
| 26 | export async function exportWallet(args: CommonArgs<{ filename?: string; readonly?: boolean }>) { |
| 27 | const { wallet, opts } = args; |