cli-whatsapp 0.1.18 → 0.1.19
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.
|
@@ -20,6 +20,7 @@ import { notify } from "../../utils/notify.js";
|
|
|
20
20
|
// ---- tab completion --------------------------------------------------------
|
|
21
21
|
const SLASH_ITEMS = [
|
|
22
22
|
{ value: '/open', desc: 'open a chat — then just type to send', args: true },
|
|
23
|
+
{ value: '/switch', desc: 'switch to another chat/contact', args: true },
|
|
23
24
|
{ value: '/close', desc: 'leave the current chat' },
|
|
24
25
|
{ value: '/chats', desc: 'list conversations' },
|
|
25
26
|
{ value: '/recent', desc: 'recently active chats' },
|
|
@@ -47,7 +48,7 @@ const SLASH_ITEMS = [
|
|
|
47
48
|
];
|
|
48
49
|
const SLASH = SLASH_ITEMS.map((it) => it.value);
|
|
49
50
|
const CHAT_CMDS = new Set([
|
|
50
|
-
'/open', '/send', '/sendfile', '/pin', '/unpin', '/archive', '/unarchive', '/history',
|
|
51
|
+
'/open', '/switch', '/send', '/sendfile', '/pin', '/unpin', '/archive', '/unarchive', '/history',
|
|
51
52
|
]);
|
|
52
53
|
let nameCache = [];
|
|
53
54
|
function refreshNames() {
|
|
@@ -439,6 +440,7 @@ function setSetting(key, value) {
|
|
|
439
440
|
// ---- help ------------------------------------------------------------------
|
|
440
441
|
const HELP = `${c.bold('Commands')} ${c.dim('(slash optional for the first word)')}
|
|
441
442
|
${c.cyan('/open')} <chat> open a chat — then just type to send
|
|
443
|
+
${c.cyan('/switch')} <chat> jump to another chat/contact
|
|
442
444
|
${c.green('@')} open a file picker to attach (↑↓ to choose, ⏎ to pick)
|
|
443
445
|
${c.cyan('/close')} leave the current chat
|
|
444
446
|
${c.cyan('/chats')} · ${c.cyan('/recent')} · ${c.cyan('/contacts')} list chats / recent / contacts
|
|
@@ -511,6 +513,7 @@ async function handle(state, raw) {
|
|
|
511
513
|
banner();
|
|
512
514
|
return;
|
|
513
515
|
case 'open':
|
|
516
|
+
case 'switch':
|
|
514
517
|
if (need(args[0], 'chat'))
|
|
515
518
|
openChat(state, args.join(' '));
|
|
516
519
|
return;
|
|
@@ -695,7 +698,7 @@ export async function shell() {
|
|
|
695
698
|
let pickerOpen = false;
|
|
696
699
|
// Commands whose <chat> argument gets the live chat picker. "final" = chat is
|
|
697
700
|
// the last arg (run on pick); "then" = chat then more input (send/sendfile).
|
|
698
|
-
const CHAT_FINAL = new Set(['open', 'history', 'pin', 'unpin', 'archive', 'unarchive']);
|
|
701
|
+
const CHAT_FINAL = new Set(['open', 'switch', 'history', 'pin', 'unpin', 'archive', 'unarchive']);
|
|
699
702
|
const CHAT_THEN = new Set(['send', 'sendfile']);
|
|
700
703
|
const clearLine = () => rl.write(null, { ctrl: true, name: 'u' });
|
|
701
704
|
// Open the chat picker for a command, then insert/run with the chosen chat.
|
|
@@ -761,7 +764,7 @@ export async function shell() {
|
|
|
761
764
|
}
|
|
762
765
|
// Space right after a chat command (typed manually) → open the chat picker.
|
|
763
766
|
if (str === ' ') {
|
|
764
|
-
const m = rl.line.match(/^\/(open|history|pin|unpin|archive|unarchive|send|sendfile) $/);
|
|
767
|
+
const m = rl.line.match(/^\/(open|switch|history|pin|unpin|archive|unarchive|send|sendfile) $/);
|
|
765
768
|
if (m) {
|
|
766
769
|
pickerOpen = true;
|
|
767
770
|
void (async () => {
|
package/package.json
CHANGED