pa-set-flag
by rob
Set a flag value in JSON output, parsing input as JSON types (boolean, number, object) or string
# pa-set-flag
Set a flag value in JSON output, parsing input as JSON types (boolean, number, object) or string.
## Installation
This is a CmdForge tool. It should be installed in `~/.cmdforge/pa-set-flag/` and available via the `pa-set-flag` command.
## Usage
```bash
# Set a string flag with no input (uses default empty string)
pa-set-flag --flag status --value pending
# Set a boolean flag from piped input
echo "true" | pa-set-flag --flag is_complete
# Set a numeric flag
echo "42" | pa-set-flag --flag count
# Set an object flag
echo '{"name": "example"}' | pa-set-flag --flag metadata
# Typical pipeline usage: pass JSON value through pipe
echo "false" | pa-set-flag --flag should_retry | other-tool
```
## Arguments
| Flag | Variable | Default | Description |
|------|----------|---------|-------------|
| `--flag` | `flag` | (required) | The flag/key name to set |
| `--value` | `value` | `""` | Default value if no stdin provided (optional) |
## How It Works
1. **set_flag**: Reads input from stdin (or uses default `--value`), attempts to parse as JSON (boolean, number, object), falls back to string if parsing fails, then outputs JSON with the specified flag as key.
## Dependencies
None
Reviews
Login to reviewNo reviews yet.
Issues
No issues reported for this tool.
Write a Review
Share your experience with this tool.
0/2000
Report an Issue
Help improve this tool by reporting bugs or security issues.