mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-07 06:28:20 +00:00
feat(cli): add --help and version support (v1.1.0)
- Add version command: ccs --version, ccs version, ccs -v - Add help forwarding: ccs --help, ccs -h, ccs help → forwards to Claude CLI - Fix W1 warning: ccs --help no longer treats --help as profile name - Consistent implementation across bash and PowerShell - Update README (EN/VI) with utility commands documentation Features: - Version constant: CCS_VERSION = "1.1.0" - Early return pattern for meta-commands (work without config) - Help commands forward to Claude CLI --help - Version commands show CCS version + GitHub URL Testing: - All 9 tests passed (100%) - No regressions in existing functionality - Verified on Windows PowerShell 5.1 Resolves: W1 warning from comprehensive testing Tested-by: QA Agent Reviewed-by: Code Review Agent
This commit is contained in:
@@ -54,9 +54,13 @@ EOF
|
||||
|
||||
**Use**:
|
||||
```bash
|
||||
ccs # Use default profile
|
||||
ccs glm # Use GLM profile
|
||||
ccs son # Use Sonnet profile
|
||||
ccs # Use default profile
|
||||
ccs glm # Use GLM profile
|
||||
ccs son # Use Sonnet profile
|
||||
|
||||
# Utility commands
|
||||
ccs --version # Show CCS version
|
||||
ccs --help # Show Claude CLI help
|
||||
```
|
||||
|
||||
## Why CCS?
|
||||
|
||||
+7
-3
@@ -54,9 +54,13 @@ EOF
|
||||
|
||||
**Sử dụng**:
|
||||
```bash
|
||||
ccs # Dùng profile mặc định
|
||||
ccs glm # Dùng GLM profile
|
||||
ccs son # Dùng Sonnet profile
|
||||
ccs # Dùng profile mặc định
|
||||
ccs glm # Dùng GLM profile
|
||||
ccs son # Dùng Sonnet profile
|
||||
|
||||
# Lệnh tiện ích
|
||||
ccs --version # Hiển thị phiên bản CCS
|
||||
ccs --help # Hiển thị trợ giúp Claude CLI
|
||||
```
|
||||
|
||||
## Tại Sao Nên Dùng CCS?
|
||||
|
||||
@@ -1,9 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Version
|
||||
CCS_VERSION="1.1.0"
|
||||
|
||||
CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
|
||||
PROFILE="${1:-default}"
|
||||
|
||||
# Special case: version command
|
||||
if [[ "$PROFILE" == "version" || "$PROFILE" == "--version" || "$PROFILE" == "-v" ]]; then
|
||||
echo "CCS (Claude Code Switch) version $CCS_VERSION"
|
||||
echo "https://github.com/kaitranntt/ccs"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Special case: help command (forward to Claude CLI)
|
||||
if [[ "$PROFILE" == "--help" || "$PROFILE" == "-h" || "$PROFILE" == "help" ]]; then
|
||||
shift # Remove the help argument
|
||||
exec claude --help "$@"
|
||||
fi
|
||||
|
||||
# Check config exists
|
||||
if [[ ! -f "$CONFIG_FILE" ]]; then
|
||||
echo "Error: Config file not found: $CONFIG_FILE"
|
||||
|
||||
@@ -12,6 +12,32 @@ param(
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Version
|
||||
$CCS_VERSION = "1.1.0"
|
||||
|
||||
# Special case: version command
|
||||
if ($Profile -eq "version" -or $Profile -eq "--version" -or $Profile -eq "-v") {
|
||||
Write-Host "CCS (Claude Code Switch) version $CCS_VERSION"
|
||||
Write-Host "https://github.com/kaitranntt/ccs"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Special case: help command (forward to Claude CLI)
|
||||
if ($Profile -eq "--help" -or $Profile -eq "-h" -or $Profile -eq "help") {
|
||||
try {
|
||||
if ($RemainingArgs) {
|
||||
& claude --help @RemainingArgs
|
||||
} else {
|
||||
& claude --help
|
||||
}
|
||||
exit $LASTEXITCODE
|
||||
} catch {
|
||||
Write-Host "Error: Failed to execute claude --help" -ForegroundColor Red
|
||||
Write-Host $_.Exception.Message
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Special case: "default" profile just runs claude directly (no profile switching)
|
||||
if ($Profile -eq "default") {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user