Add --no-color flag to task.sh CLI for machine-readable output
This commit is contained in:
parent
3bd4419866
commit
aed00c7825
@ -8,12 +8,23 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
# shellcheck source=./lib/api_client.sh
|
# shellcheck source=./lib/api_client.sh
|
||||||
source "$SCRIPT_DIR/lib/api_client.sh"
|
source "$SCRIPT_DIR/lib/api_client.sh"
|
||||||
|
|
||||||
|
# Color support - disable with --no-color or NO_COLOR env var
|
||||||
|
NO_COLOR="${NO_COLOR:-}"
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
|
# Disable colors if requested
|
||||||
|
if [[ -n "$NO_COLOR" ]]; then
|
||||||
|
RED=''
|
||||||
|
GREEN=''
|
||||||
|
YELLOW=''
|
||||||
|
BLUE=''
|
||||||
|
NC=''
|
||||||
|
fi
|
||||||
|
|
||||||
log_info() { echo -e "${BLUE}i${NC} $1"; }
|
log_info() { echo -e "${BLUE}i${NC} $1"; }
|
||||||
log_success() { echo -e "${GREEN}ok${NC} $1"; }
|
log_success() { echo -e "${GREEN}ok${NC} $1"; }
|
||||||
log_warning() { echo -e "${YELLOW}warn${NC} $1"; }
|
log_warning() { echo -e "${YELLOW}warn${NC} $1"; }
|
||||||
@ -39,7 +50,10 @@ show_usage() {
|
|||||||
Task CLI for Gantt Board
|
Task CLI for Gantt Board
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
./task.sh [list|get|create|update|delete|current-sprint|bulk-create] [args...]
|
./task.sh [--no-color] [list|get|create|update|delete|current-sprint|bulk-create] [args...]
|
||||||
|
|
||||||
|
GLOBAL FLAGS:
|
||||||
|
--no-color Disable colored output (also respects NO_COLOR env var)
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
list [status] List tasks (supports filters)
|
list [status] List tasks (supports filters)
|
||||||
@ -577,6 +591,27 @@ bulk_create() {
|
|||||||
|
|
||||||
check_dependencies
|
check_dependencies
|
||||||
|
|
||||||
|
# Handle global flags before commands
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "${1:-}" in
|
||||||
|
--no-color)
|
||||||
|
RED=''
|
||||||
|
GREEN=''
|
||||||
|
YELLOW=''
|
||||||
|
BLUE=''
|
||||||
|
NC=''
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
case "${1:-}" in
|
case "${1:-}" in
|
||||||
list)
|
list)
|
||||||
shift
|
shift
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user