en
Pseudo-Commands

Pseudo-Commands

Overview

A pseudo-command is a built-in command keyword recognized by the Bulk Actions feature. Unlike shell executables (e.g., ping or dig which invoke system binaries via Runtime.exec), pseudo-commands trigger custom Kotlin code directly inside BulkActionsRepository. There are 9 pseudo-commands:

KeywordPurpose
pingICMP ping
digDNS resolution (via dnsjava)
ntpNTP time query
port-scanTCP port scan
checkcertHTTPS certificate inspection
device-infoDevice identity info
tracertTraceroute (TTL probing)
google-timesyncGoogle Time Sync
lan-scanLAN subnet ping sweep

Unrecognized keywords fall through to a raw Runtime.exec() fallback.

How It Works

JSON config file
   "commands": {
     "ping_google":       "ping -c 5 google.com",
     "dig_example":       "dig example.com",
     "checkcert_google": "checkcert https://google.com"
   }
        β”‚
        β–Ό
BulkConfigParser.parse(json)          ← parses JSON into BulkConfig(commands=Map<String, String>)
        β”‚
        β–Ό
BulkActionsViewModel.onLoadAndRun()   ← reads config, stores in UI state
        β”‚
        β–Ό
BulkActionsRepository.executeAllCommands(commands)
        β”‚
        β”œβ”€β”€ For each (name, cmd) pair:
        β”‚    executeSingleCommand(name, cmd, timeoutMs)
        β”‚       β”‚
        β”‚       └── Parse first word β†’ dispatch via `when`:
        β”‚            "ping"         β†’ executePing()          β†’ Runtime.exec("ping -c 5 google.com")
        β”‚            "dig"          β†’ executeDig()           β†’ DigRepository.resolve()
        β”‚            "ntp"          β†’ executeNtp()           β†’ NtpRepository.query()
        β”‚            "port-scan"    β†’ executePortScan()      β†’ Socket.connect(port, timeout) Γ— N
        β”‚            "checkcert"    β†’ executeCheckcert()     β†’ HttpsCertRepository.fetchCertificate()
        β”‚            "device-info" β†’ executeDeviceInfo()    β†’ SystemInfoRepository.getDeviceInfo()
        β”‚            "tracert"      β†’ executeTracert()       β†’ Runtime.exec("ping -c 1 -t TTL host")
        β”‚            "google-timesync" β†’ executeGoogleTimeSync() β†’ GoogleTimeSyncRepository.fetchGoogleTime()
        β”‚            "lan-scan"     β†’ executeLanScan()       β†’ LanScannerRepository.pingSweep()
        β”‚           else           β†’ executeRaw()           β†’ Runtime.exec(full string)
        β”‚
        β–Ό
BulkCommandResult   (sealed hierarchy)
   β”œβ”€β”€ BulkCommandSuccess    β€” succeeded with output lines
   β”œβ”€β”€ BulkCommandError      β€” failed with error message
   β”œβ”€β”€ BulkCommandTimeout    β€” timed out
   β”œβ”€β”€ BulkCommandClosed     β€” manually stopped
   └── BulkCommandWarning    β€” succeeded but with a warning (e.g. expired cert)
        β”‚
        β”œβ”€β”€β†’ BulkActionsViewModel.generateOutputContent()   β†’ text report with summary table
        β”œβ”€β”€β†’ BulkActionsViewModel.generateCsvContent()       β†’ CSV export
        └──→ BulkActionsScreen.ResultItem()                  β†’ Compose UI display (icon + lines)

Key Classes

ClassRole
BulkConfigParserParses JSON config into BulkConfig data class
BulkActionsRepository.executeSingleCommand()Dispatches each command keyword to the correct executor
executePing() … executeLanScan()9 private executors β€” invoke repositories or system binaries
BulkCommandResult (+ subclasses)Sealed hierarchy representing execution outcomes
BulkActionsViewModel.generateOutputContent()Formats results into a text report with summary table
BulkActionsViewModel.generateCsvContent()Formats results as CSV
BulkActionsScreen.ResultItem()Renders each result in the Compose UI (icon + status + output lines)

MIT 2026 Β© Nextra.