Skip to content

Add clipboard control options, quiet mode, and Android/Termux support to croc#1002

Merged
schollz merged 3 commits intoschollz:mainfrom
chrstnwhlrt:main
Nov 19, 2025
Merged

Add clipboard control options, quiet mode, and Android/Termux support to croc#1002
schollz merged 3 commits intoschollz:mainfrom
chrstnwhlrt:main

Conversation

@chrstnwhlrt
Copy link
Copy Markdown
Contributor

Summary

Add clipboard control options, quiet mode, and Android/Termux support to croc.

Changes

New CLI Flags

  • --quiet: Suppresses all output by setting log level to error and redirecting stderr.
    Useful for scripts and automation.

  • --disable-clipboard: Prevents automatic clipboard copying of the code phrase, giving
    users control over clipboard behavior.

  • --extended-clipboard: Copies the full command with CROC_SECRET as an environment
    variable (e.g., CROC_SECRET="code-phrase" croc --relay ...) instead of just the code phrase.
    Matches the format shown in Unix/Linux/macOS instructions and includes any relay/pass flags.

Clipboard Improvements

  • Android/Termux support: Added termux-clipboard-set as a clipboard tool option and
    included "android" in the GOOS case statement (Android reports GOOS as "android", not "linux")

  • Context-aware messages: When using --extended-clipboard, the confirmation message now
    says "Command copied to clipboard!" instead of "Code copied to clipboard!" to accurately
    reflect what was copied

  • Cleaner output: Removed trailing whitespace from extended clipboard command format

Testing

All existing tests pass. Clipboard functionality verified on:

  • Linux (Wayland)
  • Android/Termux

Documentation

Updated README.md with usage examples for all new flags.

Add three new CLI flags to improve usability and automation:

- --quiet: Suppresses all output by setting log level to error and
redirecting stderr to /dev/null. Useful for scripts and automation.

- --disable-clipboard: Prevents automatic clipboard copying of the code
phrase, giving users control over clipboard behavior.

- --extended-clipboard: Copies the full command with CROC_SECRET as an
environment variable (e.g., CROC_SECRET="code" croc --relay ...) instead
of just the code phrase. Matches the format shown in the
Unix/Linux/macOS instructions and includes any relay/pass flags.

Additionally, add support for termux-clipboard-set as a fallback
clipboard utility for Android/Termux environments.

Updated README with usage examples for all new flags.
- Change clipboard confirmation message to "Command copied to
clipboard!" when using --extended-clipboard to accurately reflect what
was copied
- Remove trailing space from flags string in extended clipboard output
Add clipboard support for Android/Termux by:

- Adding "android" to the GOOS case statement (Android reports GOOS as
"android", not "linux")
- Adding termux-clipboard-set as a fallback clipboard tool alongside
other Unix clipboard utilities (xsel, xclip, wl-copy)

This enables clipboard functionality on Android devices running Termux
while maintaining compatibility with all other Unix-like systems.
@schollz schollz merged commit 89b26ca into schollz:main Nov 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants