-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy path_lnpd.ps1
107 lines (102 loc) · 10.5 KB
/
_lnpd.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
Register-ArgumentCompleter -Native -CommandName 'lnpd' -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$commandElements = $commandAst.CommandElements
$command = @(
'lnpd'
for ($i = 1; $i -lt $commandElements.Count; $i++) {
$element = $commandElements[$i]
if ($element -isnot [StringConstantExpressionAst] -or
$element.StringConstantType -ne [StringConstantType]::BareWord -or
$element.Value.StartsWith('-') -or
$element.Value -eq $wordToComplete) {
break
}
$element.Value
}) -join ';'
$completions = @(switch ($command) {
'lnpd' {
[CompletionResult]::new('-k', 'k', [CompletionResultType]::ParameterName, 'Node key file')
[CompletionResult]::new('--key-file', 'key-file', [CompletionResultType]::ParameterName, 'Node key file')
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Data directory path')
[CompletionResult]::new('--data-dir', 'data-dir', [CompletionResultType]::ParameterName, 'Data directory path')
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Path for the configuration file')
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'Path for the configuration file')
[CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Use Tor')
[CompletionResult]::new('--tor-proxy', 'tor-proxy', [CompletionResultType]::ParameterName, 'Use Tor')
[CompletionResult]::new('-M', 'M', [CompletionResultType]::ParameterName, 'ZMQ socket for peer message bus used to communicate with LNP node peerd service')
[CompletionResult]::new('--msg', 'msg', [CompletionResultType]::ParameterName, 'ZMQ socket for peer message bus used to communicate with LNP node peerd service')
[CompletionResult]::new('-X', 'X', [CompletionResultType]::ParameterName, 'ZMQ socket for internal service control bus')
[CompletionResult]::new('--ctl', 'ctl', [CompletionResultType]::ParameterName, 'ZMQ socket for internal service control bus')
[CompletionResult]::new('-R', 'R', [CompletionResultType]::ParameterName, 'ZMQ socket for LNP Node client-server RPC API')
[CompletionResult]::new('--rpc', 'rpc', [CompletionResultType]::ParameterName, 'ZMQ socket for LNP Node client-server RPC API')
[CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Blockchain to use')
[CompletionResult]::new('--chain', 'chain', [CompletionResultType]::ParameterName, 'Blockchain to use')
[CompletionResult]::new('--electrum-server', 'electrum-server', [CompletionResultType]::ParameterName, 'Electrum server to use')
[CompletionResult]::new('--electrum-port', 'electrum-port', [CompletionResultType]::ParameterName, 'Customize Electrum server port number. By default the wallet will use port matching the selected network')
[CompletionResult]::new('-L', 'L', [CompletionResultType]::ParameterName, 'Start daemon in listening mode binding the provided local address(es)')
[CompletionResult]::new('--listen', 'listen', [CompletionResultType]::ParameterName, 'Start daemon in listening mode binding the provided local address(es)')
[CompletionResult]::new('--bolt', 'bolt', [CompletionResultType]::ParameterName, 'Use BOLT protocol for listening for the incoming connections. Can optionally specify a custom port number')
[CompletionResult]::new('--bifrost', 'bifrost', [CompletionResultType]::ParameterName, 'Use Bifrost protocol for listening for the incoming connections. Can optionally specify a custom port number')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Print version information')
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version information')
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Set verbosity level')
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Set verbosity level')
[CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Spawn daemons as threads and not processes')
[CompletionResult]::new('--threaded', 'threaded', [CompletionResultType]::ParameterName, 'Spawn daemons as threads and not processes')
[CompletionResult]::new('--listen-all', 'listen-all', [CompletionResultType]::ParameterName, 'If the argument is provided, the node binds to all network addresses and requires `--bifrost` and/or `--bolt` arguments')
[CompletionResult]::new('init', 'init', [CompletionResultType]::ParameterValue, 'Initialize data directory')
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
break
}
'lnpd;init' {
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Data directory path')
[CompletionResult]::new('--data-dir', 'data-dir', [CompletionResultType]::ParameterName, 'Data directory path')
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Path for the configuration file')
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'Path for the configuration file')
[CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Use Tor')
[CompletionResult]::new('--tor-proxy', 'tor-proxy', [CompletionResultType]::ParameterName, 'Use Tor')
[CompletionResult]::new('-M', 'M', [CompletionResultType]::ParameterName, 'ZMQ socket for peer message bus used to communicate with LNP node peerd service')
[CompletionResult]::new('--msg', 'msg', [CompletionResultType]::ParameterName, 'ZMQ socket for peer message bus used to communicate with LNP node peerd service')
[CompletionResult]::new('-X', 'X', [CompletionResultType]::ParameterName, 'ZMQ socket for internal service control bus')
[CompletionResult]::new('--ctl', 'ctl', [CompletionResultType]::ParameterName, 'ZMQ socket for internal service control bus')
[CompletionResult]::new('-R', 'R', [CompletionResultType]::ParameterName, 'ZMQ socket for LNP Node client-server RPC API')
[CompletionResult]::new('--rpc', 'rpc', [CompletionResultType]::ParameterName, 'ZMQ socket for LNP Node client-server RPC API')
[CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Blockchain to use')
[CompletionResult]::new('--chain', 'chain', [CompletionResultType]::ParameterName, 'Blockchain to use')
[CompletionResult]::new('--electrum-server', 'electrum-server', [CompletionResultType]::ParameterName, 'Electrum server to use')
[CompletionResult]::new('--electrum-port', 'electrum-port', [CompletionResultType]::ParameterName, 'Customize Electrum server port number. By default the wallet will use port matching the selected network')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Set verbosity level')
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Set verbosity level')
break
}
'lnpd;help' {
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Data directory path')
[CompletionResult]::new('--data-dir', 'data-dir', [CompletionResultType]::ParameterName, 'Data directory path')
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Path for the configuration file')
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'Path for the configuration file')
[CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Use Tor')
[CompletionResult]::new('--tor-proxy', 'tor-proxy', [CompletionResultType]::ParameterName, 'Use Tor')
[CompletionResult]::new('-M', 'M', [CompletionResultType]::ParameterName, 'ZMQ socket for peer message bus used to communicate with LNP node peerd service')
[CompletionResult]::new('--msg', 'msg', [CompletionResultType]::ParameterName, 'ZMQ socket for peer message bus used to communicate with LNP node peerd service')
[CompletionResult]::new('-X', 'X', [CompletionResultType]::ParameterName, 'ZMQ socket for internal service control bus')
[CompletionResult]::new('--ctl', 'ctl', [CompletionResultType]::ParameterName, 'ZMQ socket for internal service control bus')
[CompletionResult]::new('-R', 'R', [CompletionResultType]::ParameterName, 'ZMQ socket for LNP Node client-server RPC API')
[CompletionResult]::new('--rpc', 'rpc', [CompletionResultType]::ParameterName, 'ZMQ socket for LNP Node client-server RPC API')
[CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Blockchain to use')
[CompletionResult]::new('--chain', 'chain', [CompletionResultType]::ParameterName, 'Blockchain to use')
[CompletionResult]::new('--electrum-server', 'electrum-server', [CompletionResultType]::ParameterName, 'Electrum server to use')
[CompletionResult]::new('--electrum-port', 'electrum-port', [CompletionResultType]::ParameterName, 'Customize Electrum server port number. By default the wallet will use port matching the selected network')
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Set verbosity level')
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Set verbosity level')
break
}
})
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
Sort-Object -Property ListItemText
}