Merge pull request 'feat: implement config management flags and documentation' (#6) from feat/manage-config into main
This commit was merged in pull request #6.
This commit is contained in:
@@ -52,6 +52,9 @@ Options:
|
|||||||
--[no-]copy Copy result to clipboard
|
--[no-]copy Copy result to clipboard
|
||||||
--[no-]notify Show desktop notification
|
--[no-]notify Show desktop notification
|
||||||
--desktop GUI mode: pick → copy → notify
|
--desktop GUI mode: pick → copy → notify
|
||||||
|
--get-config Print the current configuration
|
||||||
|
--set-config Update the configuration (e.g. --set-config desktop --copy)
|
||||||
|
--reset-config Restore the configuration file to its default values
|
||||||
--install Install to ~/.local/share/ and symlink to ~/.local/bin/
|
--install Install to ~/.local/share/ and symlink to ~/.local/bin/
|
||||||
--help, -h Show this help message
|
--help, -h Show this help message
|
||||||
```
|
```
|
||||||
@@ -102,6 +105,22 @@ copy = true # copy result to clipboard
|
|||||||
notify = true # show desktop notification with the copied value
|
notify = true # show desktop notification with the copied value
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also use the CLI to manage your configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# View current config
|
||||||
|
color-tool --get-config
|
||||||
|
|
||||||
|
# Update specific keys (e.g., enable swatch by default)
|
||||||
|
color-tool --set-config defaults --swatch
|
||||||
|
|
||||||
|
# Set output format for desktop mode
|
||||||
|
color-tool --set-config desktop output=rgba
|
||||||
|
|
||||||
|
# Reset to factory defaults
|
||||||
|
color-tool --reset-config
|
||||||
|
```
|
||||||
|
|
||||||
## 🧪 Testing
|
## 🧪 Testing
|
||||||
|
|
||||||
The project includes a comprehensive test suite that verifies color conversion, configuration loading, and system integrations (clipboard/notifications) using mocks.
|
The project includes a comprehensive test suite that verifies color conversion, configuration loading, and system integrations (clipboard/notifications) using mocks.
|
||||||
|
|||||||
@@ -150,6 +150,24 @@ else
|
|||||||
echo "FAIL (notify.log not created)"
|
echo "FAIL (notify.log not created)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 8. Config Management
|
||||||
|
it "manages configuration via CLI"
|
||||||
|
mkdir -p "$HOME/.config/color-tool"
|
||||||
|
"$COLOR_TOOL" --reset-config >/dev/null
|
||||||
|
|
||||||
|
# Test --set-config
|
||||||
|
"$COLOR_TOOL" --set-config defaults output=rgba
|
||||||
|
output=$("$COLOR_TOOL" --get-config)
|
||||||
|
if [[ "$output" == *"output = \"rgba\""* ]]; then
|
||||||
|
# Test --reset-config
|
||||||
|
"$COLOR_TOOL" --reset-config >/dev/null
|
||||||
|
output=$("$COLOR_TOOL" --get-config)
|
||||||
|
assert_contains "$output" "output = \"hex\""
|
||||||
|
else
|
||||||
|
echo "FAIL"
|
||||||
|
echo " Expected to find: output = \"rgba\""
|
||||||
|
echo " Actual output: $output"
|
||||||
|
fi
|
||||||
|
|
||||||
# 9. JSON Output
|
# 9. JSON Output
|
||||||
it "outputs selected formats as JSON"
|
it "outputs selected formats as JSON"
|
||||||
|
|||||||
Reference in New Issue
Block a user