pal-explorer-cli 0.4.12 → 0.4.13

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.
Files changed (99) hide show
  1. package/README.md +149 -149
  2. package/bin/pal.js +63 -2
  3. package/extensions/@palexplorer/analytics/extension.json +20 -1
  4. package/extensions/@palexplorer/analytics/index.js +19 -9
  5. package/extensions/@palexplorer/audit/extension.json +14 -0
  6. package/extensions/@palexplorer/auth-email/extension.json +15 -0
  7. package/extensions/@palexplorer/auth-oauth/extension.json +15 -0
  8. package/extensions/@palexplorer/chat/extension.json +14 -0
  9. package/extensions/@palexplorer/discovery/extension.json +17 -0
  10. package/extensions/@palexplorer/discovery/index.js +1 -1
  11. package/extensions/@palexplorer/email-notifications/extension.json +23 -0
  12. package/extensions/@palexplorer/groups/extension.json +15 -0
  13. package/extensions/@palexplorer/share-links/extension.json +15 -0
  14. package/extensions/@palexplorer/sync/extension.json +16 -0
  15. package/extensions/@palexplorer/user-mgmt/extension.json +15 -0
  16. package/lib/capabilities.js +24 -24
  17. package/lib/commands/analytics.js +175 -175
  18. package/lib/commands/api-keys.js +131 -131
  19. package/lib/commands/audit.js +235 -235
  20. package/lib/commands/auth.js +137 -137
  21. package/lib/commands/backup.js +76 -76
  22. package/lib/commands/billing.js +148 -148
  23. package/lib/commands/chat.js +217 -217
  24. package/lib/commands/cloud-backup.js +231 -231
  25. package/lib/commands/comment.js +99 -99
  26. package/lib/commands/completion.js +203 -203
  27. package/lib/commands/compliance.js +218 -218
  28. package/lib/commands/config.js +136 -136
  29. package/lib/commands/connect.js +44 -44
  30. package/lib/commands/dept.js +294 -294
  31. package/lib/commands/device.js +146 -146
  32. package/lib/commands/download.js +240 -226
  33. package/lib/commands/explorer.js +178 -178
  34. package/lib/commands/extension.js +1060 -970
  35. package/lib/commands/favorite.js +90 -90
  36. package/lib/commands/federation.js +270 -270
  37. package/lib/commands/file.js +533 -533
  38. package/lib/commands/group.js +271 -271
  39. package/lib/commands/gui-share.js +29 -29
  40. package/lib/commands/init.js +61 -61
  41. package/lib/commands/invite.js +59 -59
  42. package/lib/commands/list.js +58 -58
  43. package/lib/commands/log.js +116 -116
  44. package/lib/commands/nearby.js +108 -108
  45. package/lib/commands/network.js +251 -251
  46. package/lib/commands/notify.js +198 -198
  47. package/lib/commands/org.js +273 -273
  48. package/lib/commands/pal.js +403 -180
  49. package/lib/commands/permissions.js +216 -216
  50. package/lib/commands/pin.js +97 -97
  51. package/lib/commands/protocol.js +357 -357
  52. package/lib/commands/rbac.js +147 -147
  53. package/lib/commands/recover.js +36 -36
  54. package/lib/commands/register.js +171 -171
  55. package/lib/commands/relay.js +131 -131
  56. package/lib/commands/remote.js +368 -368
  57. package/lib/commands/revoke.js +50 -50
  58. package/lib/commands/scanner.js +280 -280
  59. package/lib/commands/schedule.js +344 -344
  60. package/lib/commands/scim.js +203 -203
  61. package/lib/commands/search.js +181 -181
  62. package/lib/commands/serve.js +438 -438
  63. package/lib/commands/server.js +350 -350
  64. package/lib/commands/share-link.js +199 -199
  65. package/lib/commands/share.js +336 -323
  66. package/lib/commands/sso.js +200 -200
  67. package/lib/commands/status.js +145 -145
  68. package/lib/commands/stream.js +562 -562
  69. package/lib/commands/su.js +187 -187
  70. package/lib/commands/sync.js +979 -979
  71. package/lib/commands/transfers.js +152 -152
  72. package/lib/commands/uninstall.js +188 -188
  73. package/lib/commands/update.js +204 -204
  74. package/lib/commands/user.js +276 -276
  75. package/lib/commands/vfs.js +84 -84
  76. package/lib/commands/web-login.js +79 -79
  77. package/lib/commands/web.js +52 -52
  78. package/lib/commands/webhook.js +180 -180
  79. package/lib/commands/whoami.js +59 -59
  80. package/lib/commands/workspace.js +121 -121
  81. package/lib/core/billing.js +16 -5
  82. package/lib/core/dhtDiscovery.js +9 -2
  83. package/lib/core/discoveryClient.js +13 -7
  84. package/lib/core/extensions.js +142 -1
  85. package/lib/core/identity.js +33 -2
  86. package/lib/core/imageProcessor.js +109 -0
  87. package/lib/core/imageTorrent.js +167 -0
  88. package/lib/core/permissions.js +1 -1
  89. package/lib/core/pro.js +11 -4
  90. package/lib/core/serverList.js +4 -1
  91. package/lib/core/shares.js +12 -1
  92. package/lib/core/signalingServer.js +14 -2
  93. package/lib/core/su.js +1 -1
  94. package/lib/core/users.js +1 -1
  95. package/lib/protocol/messages.js +12 -3
  96. package/lib/utils/explorer.js +1 -1
  97. package/lib/utils/help.js +357 -357
  98. package/lib/utils/torrent.js +1 -0
  99. package/package.json +4 -3
@@ -1,203 +1,203 @@
1
- import chalk from 'chalk';
2
-
3
- const BASH_COMPLETION = `
4
- # pe bash completion
5
- _pe_completions() {
6
- local cur="\${COMP_WORDS[COMP_CWORD]}"
7
- local prev="\${COMP_WORDS[COMP_CWORD-1]}"
8
-
9
- local commands="init whoami register recover share download list revoke serve pal invite nearby group sync transfers config device server explorer status log completion web gui-share vfs file remote user schedule chat backup api-keys share-link comment update auth network search connect protocol workspace favorite pin stream uninstall extension ext billing permissions org su federation analytics webhook relay compliance sso rbac scim audit scanner notify cloud-backup dept"
10
-
11
- case "\$prev" in
12
- pe)
13
- COMPREPLY=( $(compgen -W "\$commands" -- "\$cur") )
14
- ;;
15
- pal)
16
- COMPREPLY=( $(compgen -W "add list remove" -- "\$cur") )
17
- ;;
18
- group)
19
- COMPREPLY=( $(compgen -W "create add remove delete list broadcast" -- "\$cur") )
20
- ;;
21
- sync)
22
- COMPREPLY=( $(compgen -W "push pull status watch list remove diff" -- "\$cur") )
23
- ;;
24
- file)
25
- COMPREPLY=( $(compgen -W "ls tree info copy move rename mkdir delete search open reveal audit" -- "\$cur") )
26
- ;;
27
- remote)
28
- COMPREPLY=( $(compgen -W "browse files download" -- "\$cur") )
29
- ;;
30
- user)
31
- COMPREPLY=( $(compgen -W "list add remove promote" -- "\$cur") )
32
- ;;
33
- chat)
34
- COMPREPLY=( $(compgen -W "send history fetch" -- "\$cur") )
35
- ;;
36
- comment)
37
- COMPREPLY=( $(compgen -W "list add delete" -- "\$cur") )
38
- ;;
39
- schedule)
40
- COMPREPLY=( $(compgen -W "add cancel clear" -- "\$cur") )
41
- ;;
42
- backup)
43
- COMPREPLY=( $(compgen -W "create restore" -- "\$cur") )
44
- ;;
45
- api-keys)
46
- COMPREPLY=( $(compgen -W "create revoke" -- "\$cur") )
47
- ;;
48
- share-link)
49
- COMPREPLY=( $(compgen -W "create list" -- "\$cur") )
50
- ;;
51
- vfs)
52
- COMPREPLY=( $(compgen -W "mount unmount status" -- "\$cur") )
53
- ;;
54
- config)
55
- COMPREPLY=( $(compgen -W "list get set reset" -- "\$cur") )
56
- ;;
57
- device)
58
- COMPREPLY=( $(compgen -W "rename register list" -- "\$cur") )
59
- ;;
60
- server)
61
- COMPREPLY=( $(compgen -W "install config register status add remove list set-primary" -- "\$cur") )
62
- ;;
63
- transfers)
64
- COMPREPLY=( $(compgen -W "cancel pause resume stats" -- "\$cur") )
65
- ;;
66
- explorer)
67
- COMPREPLY=( $(compgen -W "install uninstall" -- "\$cur") )
68
- ;;
69
- *)
70
- COMPREPLY=()
71
- ;;
72
- esac
73
- }
74
- complete -F _pe_completions pe
75
- `;
76
-
77
- const ZSH_COMPLETION = `
78
- #compdef pe
79
-
80
- _pe() {
81
- local -a commands subcommands
82
-
83
- commands=(
84
- 'init:Initialize your identity'
85
- 'whoami:Display your current identity'
86
- 'register:Register a handle'
87
- 'verify:Verify OTP code'
88
- 'recover:Recover identity from mnemonic'
89
- 'share:Share a file or folder'
90
- 'list:List active shares'
91
- 'revoke:Revoke a share'
92
- 'serve:Start the sharing daemon'
93
- 'download:Download from magnet link'
94
- 'pal:Manage pals'
95
- 'invite:Generate invite link'
96
- 'nearby:Discover nearby peers'
97
- 'group:Manage groups'
98
- 'sync:Sync a directory with a pal'
99
- 'transfers:View and manage transfers'
100
- 'config:View and manage config'
101
- 'device:Manage devices'
102
- 'server:Manage headless server'
103
- 'explorer:Windows Explorer integration'
104
- 'vfs:Manage virtual filesystem drive'
105
- 'web:Open web dashboard'
106
- 'status:System health dashboard'
107
- 'log:View application logs'
108
- 'completion:Generate shell completion script'
109
- 'file:File operations with permissions'
110
- 'remote:Browse and download from pals'
111
- 'user:Manage user profiles'
112
- 'login:Switch active user profile'
113
- 'schedule:Manage scheduled tasks'
114
- 'chat:Encrypted chat messages'
115
- 'backup:Create and restore backups (Pro)'
116
- 'api-keys:Manage API keys (Pro)'
117
- 'share-link:Create web share links'
118
- 'comment:Manage comments on shares'
119
- 'update:Check for updates'
120
- 'auth:Authentication commands'
121
- 'network:Network management'
122
- 'search:Search files, pals, or groups'
123
- 'connect:Connect to a pal'
124
- 'protocol:PAL/1.0 protocol tools'
125
- 'workspace:Manage workspaces'
126
- 'favorite:Manage favorites'
127
- 'pin:Pin shares'
128
- 'stream:Media streaming'
129
- 'uninstall:Uninstall Palexplorer'
130
- 'extension:Manage extensions'
131
- 'ext:Manage extensions (alias)'
132
- 'billing:Billing and subscription'
133
- 'permissions:Manage permissions'
134
- 'org:Organization management'
135
- 'su:Switch user context'
136
- 'federation:Federation settings'
137
- 'analytics:Usage analytics'
138
- 'webhook:Manage webhooks'
139
- 'relay:TURN relay management'
140
- 'compliance:Compliance tools'
141
- 'sso:Single sign-on settings'
142
- 'rbac:Role-based access control'
143
- 'scim:SCIM provisioning'
144
- 'audit:Audit log'
145
- 'scanner:Security scanner'
146
- 'notify:Notification settings'
147
- 'cloud-backup:Cloud backup management'
148
- 'dept:Department management'
149
- )
150
-
151
- if (( CURRENT == 2 )); then
152
- _describe 'command' commands
153
- elif (( CURRENT == 3 )); then
154
- case "\$words[2]" in
155
- pal) subcommands=('add:Add a pal' 'list:List pals' 'remove:Remove a pal'); _describe 'subcommand' subcommands ;;
156
- group) subcommands=('create:Create group' 'add:Add to group' 'remove:Remove from group' 'delete:Delete group' 'list:List groups' 'broadcast:Broadcast message'); _describe 'subcommand' subcommands ;;
157
- sync) subcommands=('push:Push local changes' 'pull:Pull remote changes' 'status:Show sync status' 'watch:Watch and auto-push' 'list:List sync pairs' 'remove:Remove sync pair' 'diff:Compare folders'); _describe 'subcommand' subcommands ;;
158
- vfs) subcommands=('mount:Mount virtual drive' 'unmount:Unmount drive' 'status:Show status'); _describe 'subcommand' subcommands ;;
159
- config) subcommands=('list:Show settings' 'get:Get value' 'set:Set value' 'reset:Reset all'); _describe 'subcommand' subcommands ;;
160
- device) subcommands=('rename:Rename device' 'register:Register device' 'list:List devices'); _describe 'subcommand' subcommands ;;
161
- server) subcommands=('install:Install service' 'config:Configure' 'register:Register handle' 'status:Check health' 'add:Add server' 'remove:Remove server' 'list:List servers' 'set-primary:Set primary server'); _describe 'subcommand' subcommands ;;
162
- transfers) subcommands=('cancel:Cancel transfer' 'pause:Pause transfer' 'resume:Resume transfer' 'stats:Show statistics'); _describe 'subcommand' subcommands ;;
163
- explorer) subcommands=('install:Install integration' 'uninstall:Remove integration'); _describe 'subcommand' subcommands ;;
164
- file) subcommands=('ls:List directory' 'tree:Show tree' 'info:File properties' 'copy:Copy file' 'move:Move file' 'rename:Rename file' 'mkdir:Create directory' 'delete:Delete file' 'search:Search files' 'open:Open file' 'reveal:Show in explorer' 'audit:Audit log'); _describe 'subcommand' subcommands ;;
165
- remote) subcommands=('browse:List pal shares' 'files:List files in share' 'download:Download share'); _describe 'subcommand' subcommands ;;
166
- user) subcommands=('list:List profiles' 'add:Add profile' 'remove:Remove profile' 'promote:Promote/demote'); _describe 'subcommand' subcommands ;;
167
- chat) subcommands=('send:Send message' 'history:Show history' 'fetch:Fetch new messages'); _describe 'subcommand' subcommands ;;
168
- comment) subcommands=('list:List comments' 'add:Add comment' 'delete:Delete comment'); _describe 'subcommand' subcommands ;;
169
- schedule) subcommands=('add:Schedule task' 'cancel:Cancel task' 'clear:Clear old tasks'); _describe 'subcommand' subcommands ;;
170
- backup) subcommands=('create:Create backup' 'restore:Restore backup'); _describe 'subcommand' subcommands ;;
171
- api-keys) subcommands=('create:Create key' 'revoke:Revoke key'); _describe 'subcommand' subcommands ;;
172
- share-link) subcommands=('create:Create link' 'list:List links'); _describe 'subcommand' subcommands ;;
173
- update) subcommands=('check:Check for updates'); _describe 'subcommand' subcommands ;;
174
- esac
175
- fi
176
- }
177
-
178
- _pe
179
- `;
180
-
181
- export default function completionCommand(program) {
182
- program
183
- .command('completion')
184
- .description('generate shell completion script')
185
- .option('--shell <shell>', 'Shell type: bash or zsh', 'bash')
186
- .addHelpText('after', `
187
- Examples:
188
- $ pe completion Output bash completion script
189
- $ pe completion --shell zsh Output zsh completion script
190
- $ source <(pe completion) Activate completion in current shell
191
- `)
192
- .action((opts) => {
193
- if (opts.shell === 'zsh') {
194
- console.log(ZSH_COMPLETION.trim());
195
- console.log('');
196
- console.log(chalk.gray('# Add to ~/.zshrc or save to a file in your fpath'));
197
- } else {
198
- console.log(BASH_COMPLETION.trim());
199
- console.log('');
200
- console.log(chalk.gray('# Add to ~/.bashrc or run: eval "$(pe completion)"'));
201
- }
202
- });
203
- }
1
+ import chalk from 'chalk';
2
+
3
+ const BASH_COMPLETION = `
4
+ # pal bash completion
5
+ _pal_completions() {
6
+ local cur="\${COMP_WORDS[COMP_CWORD]}"
7
+ local prev="\${COMP_WORDS[COMP_CWORD-1]}"
8
+
9
+ local commands="init whoami register recover share download list revoke serve pal invite nearby group sync transfers config device server explorer status log completion web gui-share vfs file remote user schedule chat backup api-keys share-link comment update auth network search connect protocol workspace favorite pin stream uninstall extension ext billing permissions org su federation analytics webhook relay compliance sso rbac scim audit scanner notify cloud-backup dept"
10
+
11
+ case "\$prev" in
12
+ pal)
13
+ COMPREPLY=( $(compgen -W "\$commands" -- "\$cur") )
14
+ ;;
15
+ pal)
16
+ COMPREPLY=( $(compgen -W "add list remove" -- "\$cur") )
17
+ ;;
18
+ group)
19
+ COMPREPLY=( $(compgen -W "create add remove delete list broadcast" -- "\$cur") )
20
+ ;;
21
+ sync)
22
+ COMPREPLY=( $(compgen -W "push pull status watch list remove diff" -- "\$cur") )
23
+ ;;
24
+ file)
25
+ COMPREPLY=( $(compgen -W "ls tree info copy move rename mkdir delete search open reveal audit" -- "\$cur") )
26
+ ;;
27
+ remote)
28
+ COMPREPLY=( $(compgen -W "browse files download" -- "\$cur") )
29
+ ;;
30
+ user)
31
+ COMPREPLY=( $(compgen -W "list add remove promote" -- "\$cur") )
32
+ ;;
33
+ chat)
34
+ COMPREPLY=( $(compgen -W "send history fetch" -- "\$cur") )
35
+ ;;
36
+ comment)
37
+ COMPREPLY=( $(compgen -W "list add delete" -- "\$cur") )
38
+ ;;
39
+ schedule)
40
+ COMPREPLY=( $(compgen -W "add cancel clear" -- "\$cur") )
41
+ ;;
42
+ backup)
43
+ COMPREPLY=( $(compgen -W "create restore" -- "\$cur") )
44
+ ;;
45
+ api-keys)
46
+ COMPREPLY=( $(compgen -W "create revoke" -- "\$cur") )
47
+ ;;
48
+ share-link)
49
+ COMPREPLY=( $(compgen -W "create list" -- "\$cur") )
50
+ ;;
51
+ vfs)
52
+ COMPREPLY=( $(compgen -W "mount unmount status" -- "\$cur") )
53
+ ;;
54
+ config)
55
+ COMPREPLY=( $(compgen -W "list get set reset" -- "\$cur") )
56
+ ;;
57
+ device)
58
+ COMPREPLY=( $(compgen -W "rename register list" -- "\$cur") )
59
+ ;;
60
+ server)
61
+ COMPREPLY=( $(compgen -W "install config register status add remove list set-primary" -- "\$cur") )
62
+ ;;
63
+ transfers)
64
+ COMPREPLY=( $(compgen -W "cancel pause resume stats" -- "\$cur") )
65
+ ;;
66
+ explorer)
67
+ COMPREPLY=( $(compgen -W "install uninstall" -- "\$cur") )
68
+ ;;
69
+ *)
70
+ COMPREPLY=()
71
+ ;;
72
+ esac
73
+ }
74
+ complete -F _pal_completions pal
75
+ `;
76
+
77
+ const ZSH_COMPLETION = `
78
+ #compdef pal
79
+
80
+ _pe() {
81
+ local -a commands subcommands
82
+
83
+ commands=(
84
+ 'init:Initialize your identity'
85
+ 'whoami:Display your current identity'
86
+ 'register:Register a handle'
87
+ 'verify:Verify OTP code'
88
+ 'recover:Recover identity from mnemonic'
89
+ 'share:Share a file or folder'
90
+ 'list:List active shares'
91
+ 'revoke:Revoke a share'
92
+ 'serve:Start the sharing daemon'
93
+ 'download:Download from magnet link'
94
+ 'pal:Manage pals'
95
+ 'invite:Generate invite link'
96
+ 'nearby:Discover nearby peers'
97
+ 'group:Manage groups'
98
+ 'sync:Sync a directory with a pal'
99
+ 'transfers:View and manage transfers'
100
+ 'config:View and manage config'
101
+ 'device:Manage devices'
102
+ 'server:Manage headless server'
103
+ 'explorer:Windows Explorer integration'
104
+ 'vfs:Manage virtual filesystem drive'
105
+ 'web:Open web dashboard'
106
+ 'status:System health dashboard'
107
+ 'log:View application logs'
108
+ 'completion:Generate shell completion script'
109
+ 'file:File operations with permissions'
110
+ 'remote:Browse and download from pals'
111
+ 'user:Manage user profiles'
112
+ 'login:Switch active user profile'
113
+ 'schedule:Manage scheduled tasks'
114
+ 'chat:Encrypted chat messages'
115
+ 'backup:Create and restore backups (Pro)'
116
+ 'api-keys:Manage API keys (Pro)'
117
+ 'share-link:Create web share links'
118
+ 'comment:Manage comments on shares'
119
+ 'update:Check for updates'
120
+ 'auth:Authentication commands'
121
+ 'network:Network management'
122
+ 'search:Search files, pals, or groups'
123
+ 'connect:Connect to a pal'
124
+ 'protocol:PAL/1.0 protocol tools'
125
+ 'workspace:Manage workspaces'
126
+ 'favorite:Manage favorites'
127
+ 'pin:Pin shares'
128
+ 'stream:Media streaming'
129
+ 'uninstall:Uninstall Palexplorer'
130
+ 'extension:Manage extensions'
131
+ 'ext:Manage extensions (alias)'
132
+ 'billing:Billing and subscription'
133
+ 'permissions:Manage permissions'
134
+ 'org:Organization management'
135
+ 'su:Switch user context'
136
+ 'federation:Federation settings'
137
+ 'analytics:Usage analytics'
138
+ 'webhook:Manage webhooks'
139
+ 'relay:TURN relay management'
140
+ 'compliance:Compliance tools'
141
+ 'sso:Single sign-on settings'
142
+ 'rbac:Role-based access control'
143
+ 'scim:SCIM provisioning'
144
+ 'audit:Audit log'
145
+ 'scanner:Security scanner'
146
+ 'notify:Notification settings'
147
+ 'cloud-backup:Cloud backup management'
148
+ 'dept:Department management'
149
+ )
150
+
151
+ if (( CURRENT == 2 )); then
152
+ _describe 'command' commands
153
+ elif (( CURRENT == 3 )); then
154
+ case "\$words[2]" in
155
+ pal) subcommands=('add:Add a pal' 'list:List pals' 'remove:Remove a pal'); _describe 'subcommand' subcommands ;;
156
+ group) subcommands=('create:Create group' 'add:Add to group' 'remove:Remove from group' 'delete:Delete group' 'list:List groups' 'broadcast:Broadcast message'); _describe 'subcommand' subcommands ;;
157
+ sync) subcommands=('push:Push local changes' 'pull:Pull remote changes' 'status:Show sync status' 'watch:Watch and auto-push' 'list:List sync pairs' 'remove:Remove sync pair' 'diff:Compare folders'); _describe 'subcommand' subcommands ;;
158
+ vfs) subcommands=('mount:Mount virtual drive' 'unmount:Unmount drive' 'status:Show status'); _describe 'subcommand' subcommands ;;
159
+ config) subcommands=('list:Show settings' 'get:Get value' 'set:Set value' 'reset:Reset all'); _describe 'subcommand' subcommands ;;
160
+ device) subcommands=('rename:Rename device' 'register:Register device' 'list:List devices'); _describe 'subcommand' subcommands ;;
161
+ server) subcommands=('install:Install service' 'config:Configure' 'register:Register handle' 'status:Check health' 'add:Add server' 'remove:Remove server' 'list:List servers' 'set-primary:Set primary server'); _describe 'subcommand' subcommands ;;
162
+ transfers) subcommands=('cancel:Cancel transfer' 'pause:Pause transfer' 'resume:Resume transfer' 'stats:Show statistics'); _describe 'subcommand' subcommands ;;
163
+ explorer) subcommands=('install:Install integration' 'uninstall:Remove integration'); _describe 'subcommand' subcommands ;;
164
+ file) subcommands=('ls:List directory' 'tree:Show tree' 'info:File properties' 'copy:Copy file' 'move:Move file' 'rename:Rename file' 'mkdir:Create directory' 'delete:Delete file' 'search:Search files' 'open:Open file' 'reveal:Show in explorer' 'audit:Audit log'); _describe 'subcommand' subcommands ;;
165
+ remote) subcommands=('browse:List pal shares' 'files:List files in share' 'download:Download share'); _describe 'subcommand' subcommands ;;
166
+ user) subcommands=('list:List profiles' 'add:Add profile' 'remove:Remove profile' 'promote:Promote/demote'); _describe 'subcommand' subcommands ;;
167
+ chat) subcommands=('send:Send message' 'history:Show history' 'fetch:Fetch new messages'); _describe 'subcommand' subcommands ;;
168
+ comment) subcommands=('list:List comments' 'add:Add comment' 'delete:Delete comment'); _describe 'subcommand' subcommands ;;
169
+ schedule) subcommands=('add:Schedule task' 'cancel:Cancel task' 'clear:Clear old tasks'); _describe 'subcommand' subcommands ;;
170
+ backup) subcommands=('create:Create backup' 'restore:Restore backup'); _describe 'subcommand' subcommands ;;
171
+ api-keys) subcommands=('create:Create key' 'revoke:Revoke key'); _describe 'subcommand' subcommands ;;
172
+ share-link) subcommands=('create:Create link' 'list:List links'); _describe 'subcommand' subcommands ;;
173
+ update) subcommands=('check:Check for updates'); _describe 'subcommand' subcommands ;;
174
+ esac
175
+ fi
176
+ }
177
+
178
+ _pe
179
+ `;
180
+
181
+ export default function completionCommand(program) {
182
+ program
183
+ .command('completion')
184
+ .description('generate shell completion script')
185
+ .option('--shell <shell>', 'Shell type: bash or zsh', 'bash')
186
+ .addHelpText('after', `
187
+ Examples:
188
+ $ pal completion Output bash completion script
189
+ $ pal completion --shell zsh Output zsh completion script
190
+ $ source <(pal completion) Activate completion in current shell
191
+ `)
192
+ .action((opts) => {
193
+ if (opts.shell === 'zsh') {
194
+ console.log(ZSH_COMPLETION.trim());
195
+ console.log('');
196
+ console.log(chalk.gray('# Add to ~/.zshrc or save to a file in your fpath'));
197
+ } else {
198
+ console.log(BASH_COMPLETION.trim());
199
+ console.log('');
200
+ console.log(chalk.gray('# Add to ~/.bashrc or run: eval "$(pal completion)"'));
201
+ }
202
+ });
203
+ }