Files
kucherenko__jscpd/fixtures/shebang/deploy
apk 1101bedcc1 feat(finder): shebang-based detection for extensionless script files + --formats-names option
- Detect format from shebang line (#!) for executable extensionless files (chmod +x)
  as fallback in skipNotSupportedFormats; symlinks excluded via lstatSync
- Add SHEBANG_TO_FORMAT map and readShebangFormat() in packages/finder/src/files.ts
- Introduce IEntry interface extending fast-glob Entry with detectedFormat? field
- Add --formats-names CLI option to map specific filenames (e.g. Makefile, Dockerfile)
  to formats, independent of --formats-exts so neither disables built-in EXT_TO_FORMAT
- Wire formatsNames through IOptions, getDefaultOptions, CLI parser, and both
  call sites (skipNotSupportedFormats, in-files-detector)
- Add fixtures/shebang/ with 4 executable extensionless fixtures (bash + python)
- 360 tests pass (277 tokenizer + 83 finder); README updated with new sections
2026-05-13 20:48:59 +02:00

41 lines
838 B
Bash
Executable File

#!/bin/bash
# Common utility functions
log_message() {
local level="$1"
local message="$2"
echo "[$(date +%Y-%m-%d\ %H:%M:%S)] [$level] $message"
}
check_root() {
if [ "$(id -u)" -ne 0 ]; then
log_message "ERROR" "This script must be run as root"
exit 1
fi
}
setup_directories() {
local base_dir="$1"
mkdir -p "$base_dir/logs"
mkdir -p "$base_dir/tmp"
mkdir -p "$base_dir/config"
log_message "INFO" "Created directory structure under $base_dir"
}
validate_input() {
local input="$1"
if [ -z "$input" ]; then
log_message "ERROR" "Input cannot be empty"
return 1
fi
return 0
}
# Script-specific: deploy application
deploy_app() {
local app="$1"
local env="$2"
log_message "INFO" "Deploying $app to $env"
systemctl restart "$app"
}