using namespace System.Management.Automation using namespace System.Management.Automation.Language Register-ArgumentCompleter -Native -CommandName 'channeld' -ScriptBlock { param($wordToComplete, $commandAst, $cursorPosition) $commandElements = $commandAst.CommandElements $command = @( 'channeld' 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) { 'channeld' { [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('-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('-r', 'r', [CompletionResultType]::ParameterName, 'Flag indicating that we are re-establishing a channel with the provided `channel_id`') [CompletionResult]::new('--reestablish', 'reestablish', [CompletionResultType]::ParameterName, 'Flag indicating that we are re-establishing a channel with the provided `channel_id`') [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') break } }) $completions.Where{ $_.CompletionText -like "$wordToComplete*" } | Sort-Object -Property ListItemText }