diff --git a/main.js b/main.js index 9f044c2..1375f2a 100644 --- a/main.js +++ b/main.js @@ -2,7 +2,7 @@ import { exec } from 'node:child_process'; import { overrideConsole } from 'nodejs-better-console'; import Eris from 'eris'; -import { Command } from 'commander'; +import { Command, Argument } from 'commander'; import KeyEvent from 'keyevent.json' assert { type: 'json' }; import { parse } from 'shell-quote'; @@ -51,6 +51,16 @@ const isRaw: true } }); + program + .command('home') + .alias('h') + .description('Go to home') + .action(() => adb(`input keyevent ${KeyEvent.KEYCODE_HOME}`)); + program + .command('back') + .alias('b') + .description('Go back') + .action(() => adb(`input keyevent ${KeyEvent.KEYCODE_BACK}`)); program .command('p') .description('Play/pause media') @@ -63,6 +73,30 @@ const .command('pause') .description('Pause media') .action(() => adb(`input keyevent ${KeyEvent.KEYCODE_MEDIA_PAUSE}`)); + program + .command('prev') + .description('Previous media') + .action(() => adb(`input keyevent ${KeyEvent.KEYCODE_MEDIA_PREVIOUS}`)); + program + .command('next') + .description('Next media') + .action(() => adb(`input keyevent ${KeyEvent.KEYCODE_MEDIA_NEXT}`)); + program + .command('type') + .description('Type text') + .argument('', 'Text to type') + .action(text => adb(`input text ${text}`)); + program + .command('press') + .description('Press key') + .addArgument( + new Argument('', 'Key to press') + .choices(['tab', 'shift-tab', 'enter']) + ) + .action(key => adb(`input keyevent ${{ + 'tab': KeyEvent.KEYCODE_TAB, + 'enter': KeyEvent.KEYCODE_ENTER + }[key]}`)); program .command('spotify') .description('Launch Spotify') @@ -72,6 +106,11 @@ const .description('Launch MPV') .argument('', 'Media URL') .action(url => adb(`am start -a android.intent.action.VIEW -d ${url} -t video/any is.xyz.mpv`)); + program + .command('kiwi') + .description('Launch Kiwi browser') + .argument('', 'Website URL') + .action(url => adb(`am start -a android.intent.action.VIEW -d ${url} -t text/plain com.kiwibrowser.browser`)); try { await program.parseAsync( parse(command),