| Crates.io | flop-cli |
| lib.rs | flop-cli |
| version | 0.4.0 |
| created_at | 2025-11-01 06:53:53.528699+00 |
| updated_at | 2025-11-07 13:21:14.961921+00 |
| description | Interactively flip debug output statements in C/C++/Rust/Java/Go code |
| homepage | |
| repository | https://github.com/Justhiro55/flop |
| max_upload_size | |
| id | 1911769 |
| size | 283,109 |
Flip output is an interactive command-line tool that helps you manage output statements in C/C++/Rust/Java/Go code. It works by recursively searching your codebase and lets you toggle statements with an intuitive interface.

--debug to filter by keyword--previewon), enable for debugging (off)# Disable all output (interactive TUI by default)
$ flop on
# Disable only debug output (interactive)
$ flop on --debug
# Disable all output in batch mode (with confirmation)
$ flop on --yes
# Preview what would be changed without modifying files
$ flop on --preview src/
# Disable debug output only in batch mode
$ flop on -dy src/
# Delete all output statements permanently (interactive)
$ flop delete src/
# Process a single file
$ flop on main.c
If you're a Rust programmer, flop can be installed with cargo:
cargo install flop-cli
You'll need Rust installed (1.70.0 or newer).
git clone https://github.com/Justhiro55/flop.git
cd flop
cargo build --release
The binary will be available at ./target/release/flop.
cargo install --path .
# Or copy the binary manually
sudo cp target/release/flop /usr/local/bin/
flop <COMMAND> [OPTIONS] [PATH]
Commands:
off Uncomment output statements (enable output)
on Comment out output statements (disable output)
delete Delete output statements permanently
Arguments:
[PATH] Path to file or directory (defaults to current directory if not specified)
Options:
-d, --debug Only process output statements containing 'debug' keyword
-y, --yes Skip interactive selection (batch mode, confirmation still required)
-p, --preview Preview mode - show what would be changed without modifying files
-h, --help Print help
By default, flop searches for all C/C++/Rust/Java/Go output functions in your codebase. Use the --debug flag to filter only statements containing "debug" or "DEBUG" keywords.
Detected output functions include:
Supported file extensions:
.c.h.cpp.hpp.cc.cxx.rs.java.goDetected functions:
C standard functions:
printf(), fprintf(), sprintf(), snprintf(), dprintf()puts(), fputs()write()perror()printf_debug()C++ streams:
std::coutstd::cerrstd::clogRust macros:
println!(), eprintln!()print!(), eprint!()dbg!()Java statements:
System.out.println(), System.out.printf(), System.out.print()System.err.println(), System.err.printf(), System.err.print()Go functions:
fmt.Println(), fmt.Printf(), fmt.Print()fmt.Fprintln(), fmt.Fprintf(), fmt.Fprint()log.Println(), log.Printf(), log.Print()log.Fatal*(), log.Panic*()By default, flop opens an interactive TUI where you can select which statements to process:
# Disable all output statements (interactive)
flop on
# Navigate with arrow keys or hjkl
# Toggle selection with Space/Tab
# Navigate between files with Left/Right arrows
# Press Enter to confirm, Esc/q to cancel
# Interactively disable all output
flop on
# Disable only debug output (interactive)
flop on --debug
# Interactively enable all output
flop off src/
# Enable only debug output (interactive)
flop off --debug src/
Use -y or --yes to skip interactive selection and process all matched statements (confirmation still required):
# Disable all output in batch mode
flop on --yes
# Disable debug output only in batch mode
flop on -dy src/
# Enable all output in batch mode
flop off -y
# Interactive mode
flop on main.c
# Batch mode
flop on -y main.c
# Interactive deletion
flop delete src/
# Batch deletion (confirmation required)
flop delete -y src/
Warning: This permanently removes statement lines from your files. Use with caution!
Preview what would be changed without actually modifying any files:
# Preview changes (interactive)
flop on --preview src/
# Preview in batch mode
flop on -yp src/
# Preview debug output only
flop on -dp src/
Preview mode never modifies files. It's useful for:
By default, flop detects all output functions. Use --debug to filter only statements containing "debug" or "DEBUG" keywords:
# Process only debug output (interactive)
flop on --debug
# This will detect:
# - printf("debug: message") ← detected
# - printf("Regular message") ← NOT detected with --debug
# - std::cout << "DEBUG: xyz" ← detected
When prompted for confirmation, type n to cancel without making changes:
Do you want to disable (comment out) these statements? (y/n): n
Operation cancelled.
cargo build --release
The repository includes sample C files in the tests/ and sample/ directories for testing:
# Build the project
cargo build --release
# Navigate to the tests directory and run flop without path argument
cd tests/
../target/release/flop on
# Disable all debug statements (type 'y' to confirm)
../target/release/flop on
# Verify they are commented out
cat main.c
# Enable all debug statements (type 'y' to confirm)
../target/release/flop off
# Verify they are uncommented
cat main.c
# Go back to project root
cd ..
You can also test with the sample/ directory which contains more comprehensive examples:
./target/release/flop on sample/
flop on)flop off)--preview to preview changes before applying them--debug--yes flag for scripts while keeping confirmationThis project is dual-licensed under the MIT License and Apache License 2.0.
See LICENSE for details.