# cstats Fish Hook
# Generated automatically - do not edit manually
# Shell: {{shell_type}}
# Default source: {{default_source}}
# Environment variables
{{env_vars}}
# Core cstats wrapper function
function cstats_wrap
set cmd $argv
{{cstats_path}} collect --source "{{default_source}}" --command "$cmd"
end
# Convenient alias for manual usage
alias cs='cstats_wrap'
# Auto-wrapped commands
{{auto_commands}}
# Utility functions
function cstats_recent
set hours $argv[1]
if test -z "$hours"
set hours 1
end
set start_time (date -d "$hours hours ago" -Iseconds)
{{cstats_path}} analyze --source "{{default_source}}" --start-time "$start_time"
end
function cstats_today
set start_time (date -d "today 00:00" -Iseconds)
{{cstats_path}} analyze --source "{{default_source}}" --start-time "$start_time"
end
function cstats_clear_cache
{{cstats_path}} cache clear
end
function cstats_status
{{cstats_path}} cache stats
end
# Fish-specific: event-based collection
{{#if auto_collect_all}}
# CAUTION: This will collect statistics for ALL commands
# Uncomment the following to enable:
# function cstats_auto_collect --on-event fish_preexec
# cstats collect --source "{{default_source}}" --command "$argv" &
# end
{{/if}}
echo "✓ cstats {{shell_type}} hook loaded. Use 'cs <command>' to collect statistics."