balanceofsatoshis 18.2.8 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # Versions
2
2
 
3
- ## 18.2.8
3
+ ## 19.0.0
4
+
5
+ - `install-completion`: Add command to install shell tab autocompletion
6
+ - `uninstall-completion`: Add command to remove shell tab autocompletion
7
+
8
+ ### Breaking Changes
9
+
10
+ The previous autocompletion mode that required editing shell profile is no
11
+ longer supported. To enable or disable autocompletion, run the new install or
12
+ uninstall completion commands.
13
+
14
+ ## 18.2.9
4
15
 
5
16
  - `graph`: represent inbound fees in policy display
6
17
  - `rebalance`: fix support for 0.18.0 inbound fees
package/README.md CHANGED
@@ -54,12 +54,13 @@ bos help commandName
54
54
  If you want autocomplete on commands and options you can do:
55
55
 
56
56
  ```
57
- ## Autocomplete on MacOS/ZSH shells (on startup: you can add this to ~/.zshrc)
58
- autoload -Uz compinit && compinit
59
- source <(bos completion zsh)
57
+ bos install-completion
58
+ ```
59
+
60
+ Or to remove autocomplete
60
61
 
61
- ## Autocomplete on bash (on startup: add to ~/.profile or ~/.bash_profile)
62
- source <(bos completion bash)
62
+ ```shell
63
+ bos uninstall-completion
63
64
  ```
64
65
 
65
66
  ## Community
package/bos CHANGED
@@ -18,7 +18,9 @@ const lnService = importLazy('ln-service');
18
18
  const lnSync = importLazy('ln-sync');
19
19
  const paidServices = importLazy('paid-services');
20
20
  const prog = require('@alexbosworth/caporal');
21
+ const tabtab = importLazy('tabtab');
21
22
 
23
+ const autocomplete = require('./commands/autocomplete');
22
24
  const commandConstants = require('./commands/constants');
23
25
 
24
26
  const {accountingCategories} = commandConstants;
@@ -62,6 +64,7 @@ const months = [...Array(12).keys()].map(n => ++n);
62
64
  const {REPEATABLE} = prog;
63
65
  const {STRING} = prog;
64
66
  const yearMatch = /^\d{4}$/;
67
+
65
68
  prog
66
69
  .version(version)
67
70
 
@@ -1074,6 +1077,21 @@ prog
1074
1077
  });
1075
1078
  })
1076
1079
 
1080
+ // Add tab completions
1081
+ .command('install-completion')
1082
+ .help('Add tab autocompletion to your shell profile')
1083
+ .visible(false)
1084
+ .action(async (args, options, logger) => {
1085
+ try {
1086
+ await tabtab.install({
1087
+ completer: commandConstants.process,
1088
+ name: commandConstants.process,
1089
+ });
1090
+ } catch (err) {
1091
+ return logger.error({err}) && reject();
1092
+ }
1093
+ })
1094
+
1077
1095
  // Create an invoice
1078
1096
  .command('invoice', 'Create an invoice and get a BOLT 11 payment request')
1079
1097
  .help('Amount can take m/k variables: 5*m for 5 million, 250*k = 0.0025')
@@ -2128,6 +2146,18 @@ prog
2128
2146
  });
2129
2147
  })
2130
2148
 
2149
+ // Remove tab completions
2150
+ .command('uninstall-completion')
2151
+ .help('Remove tab autocompletion from your shell profile')
2152
+ .visible(false)
2153
+ .action(async (args, options, logger) => {
2154
+ try {
2155
+ await tabtab.uninstall({name: commandConstants.process});
2156
+ } catch (err) {
2157
+ return logger.error({err}) && reject();
2158
+ }
2159
+ })
2160
+
2131
2161
  // Unlock wallet
2132
2162
  .command('unlock', 'Unlock wallet if locked')
2133
2163
  .help('Check if the wallet is locked, if so use a password file to unlock')
@@ -2197,4 +2227,6 @@ prog
2197
2227
  });
2198
2228
  });
2199
2229
 
2230
+ autocomplete({prog});
2231
+
2200
2232
  prog.parse(process.argv);
@@ -0,0 +1,59 @@
1
+ const minimist = require('minimist');
2
+ const tabtab = require('tabtab');
3
+
4
+ const arguments = () => process.argv.slice(2);
5
+
6
+ /** Initialize autocomplete
7
+
8
+ {
9
+ prog: <Caporal Program Object>
10
+ }
11
+ */
12
+ module.exports = ({prog}) => {
13
+ const opts = minimist(arguments());
14
+
15
+ const args = opts._;
16
+
17
+ const completion = env => {
18
+ // Exit early when not completing a tab
19
+ if (!env.complete) {
20
+ return;
21
+ }
22
+
23
+ // Find the referenced command to see if it exists and has options
24
+ const command = prog.getCommands().find(n => n.name() === env.prev);
25
+
26
+ // Exit early when looking at the options for a command
27
+ if (!!command) {
28
+ return tabtab.log(command._options.map(option => ({
29
+ description: option._description,
30
+ name: option.getLongName(),
31
+ })));
32
+ }
33
+
34
+ // Filter out invisible commands
35
+ const visible = prog.getCommands().filter(n => n._visible);
36
+
37
+ // List all the relevant commands
38
+ return tabtab.log(visible.map(command => ({
39
+ description: command._description,
40
+ name: command.name(),
41
+ })));
42
+ };
43
+
44
+ // Look for completion help
45
+ const init = async () => {
46
+ const [cmd] = args;
47
+
48
+ // Exit early when not helping with completion
49
+ if (cmd !== 'completion') {
50
+ return;
51
+ }
52
+
53
+ const env = tabtab.parseEnv(process.env);
54
+
55
+ return completion(env);
56
+ };
57
+
58
+ return init();
59
+ };
@@ -24,6 +24,7 @@
24
24
  "public_key"
25
25
  ],
26
26
  "priceProviders": ["coinbase", "coindesk", "coingecko"],
27
+ "process": "bos",
27
28
  "rateProviders": ["coindesk", "coingecko"],
28
29
  "swapTypes": ["inbound", "outbound"]
29
30
  }
package/commands/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const {accountingCategories} = require('./constants');
2
+ const autocomplete = require('./autocomplete');
2
3
  const callRawApi = require('./call_raw_api');
3
4
  const fetchRequest = require('./fetch_request');
4
5
  const interrogate = require('./interrogate');
@@ -10,6 +11,7 @@ const {swapTypes} = require('./constants');
10
11
 
11
12
  module.exports = {
12
13
  accountingCategories,
14
+ autocomplete,
13
15
  callRawApi,
14
16
  fetchRequest,
15
17
  interrogate,
@@ -443,7 +443,7 @@ module.exports = (args, cbk) => {
443
443
  result: {
444
444
  announce_channel: !!message.params.announce_channel,
445
445
  channel: null,
446
- channel_expiry_blocks: defaultLifetimeBlocks,
446
+ channel_expiry_blocks: message.params.channel_expiry_blocks,
447
447
  client_balance_sat: Number().toString(),
448
448
  funding_confirms_within_blocks: confTarget,
449
449
  created_at: new Date().toISOString(),
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@alexbosworth/blockchain": "2.0.0",
14
- "@alexbosworth/caporal": "1.4.4",
14
+ "@alexbosworth/caporal": "2.0.0",
15
15
  "@alexbosworth/fiat": "2.0.0",
16
16
  "@alexbosworth/html2unicode": "1.1.5",
17
17
  "@alexbosworth/node-fetch": "2.6.2",
@@ -20,7 +20,7 @@
20
20
  "async": "3.2.5",
21
21
  "asyncjs-util": "1.2.12",
22
22
  "bech32": "2.0.0",
23
- "bip66": "1.1.5",
23
+ "bip66": "2.0.0",
24
24
  "bitcoinjs-lib": "6.1.6",
25
25
  "bolt01": "2.0.0",
26
26
  "bolt03": "1.3.2",
@@ -31,23 +31,25 @@
31
31
  "csv-parse": "5.5.6",
32
32
  "ecpair": "2.1.0",
33
33
  "goldengate": "14.0.7",
34
- "grammy": "1.25.0",
34
+ "grammy": "1.26.0",
35
35
  "hot-formula-parser": "4.0.0",
36
36
  "import-lazy": "4.0.0",
37
37
  "ini": "4.1.3",
38
- "inquirer": "9.2.23",
38
+ "inquirer": "9.3.2",
39
39
  "ln-accounting": "8.0.3",
40
40
  "ln-service": "57.14.3",
41
41
  "ln-sync": "6.0.4",
42
42
  "ln-telegram": "6.1.6",
43
+ "minimist": "1.2.8",
43
44
  "moment": "2.30.1",
44
45
  "paid-services": "6.1.4",
45
46
  "probing": "5.0.2",
46
47
  "psbt": "3.0.0",
47
48
  "qrcode-terminal": "0.12.0",
48
49
  "sanitize-filename": "1.6.3",
49
- "socks-proxy-agent": "8.0.3",
50
+ "socks-proxy-agent": "8.0.4",
50
51
  "table": "6.8.2",
52
+ "tabtab": "3.0.2",
51
53
  "tiny-secp256k1": "2.2.3",
52
54
  "window-size": "1.1.1"
53
55
  },
@@ -82,5 +84,5 @@
82
84
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
83
85
  "test": "npx nyc@15.1.0 node --experimental-test-coverage --test test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/telegram/*.js test/wallets/*.js"
84
86
  },
85
- "version": "18.2.8"
87
+ "version": "19.0.0"
86
88
  }
@@ -22,7 +22,7 @@ const report = [
22
22
  },
23
23
  {},
24
24
  {
25
- subtitle: '54 years ago',
25
+ subtitle: '55 years ago',
26
26
  title: 'Last Block:',
27
27
  },
28
28
  {