Files
fish-config/functions/docker.fish
T
rootiest 23420b3235 fix(functions): split dops.fish into dops and docker
dops.fish defined `docker`, not `dops`. dops was never defined; docker
was only conditionally defined as a side effect of the failed dops
autoload, so its behavior could silently change mid-session. See
JOB-BRIEF-FINDINGS.md §1.

- functions/dops.fish now defines dops: a real enhanced `docker ps`
  listing (custom Names/Image/Status/Ports table), with its own --help.
- functions/docker.fish is a new file holding the ps-redirect wrapper,
  fixed to actually call dops (previously called the still-undefined
  dops from inside itself).
- Bare `docker` with no arguments no longer falls through an
  if-with-no-else (the fish false-zero, AGENTS.md standing gotcha #5)
  and does nothing; it now runs the real docker binary, which prints
  its own usage.
- tests/functional.fish: updated the now-stale comment explaining why
  the help-flag check resolves the real function name instead of the
  file stem.
2026-09-08 01:11:49 -04:00

42 lines
1011 B
Fish

# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# CATEGORY
# 12-ai-and-developer-tools
#
# DEPENDENCIES
# dops
#
# SYNOPSIS
# docker [subcommand] [args...]
#
# DESCRIPTION
# Wrapper for docker that intercepts the ps subcommand and redirects it to
# the dops function for enhanced container listing. All other subcommands,
# and a bare invocation with no subcommand, are passed through to the real
# docker binary.
#
# ARGUMENTS
# subcommand Docker subcommand (ps is redirected to dops)
# args... Arguments forwarded to docker or dops
#
# EXIT STATUS
# Exit status of dops (for ps), or of the real docker binary otherwise
#
# EXAMPLE
# docker ps
# docker
function docker --description 'Execute docker, redirecting ps to the enhanced dops listing'
if test -z "$argv[1]"
command docker
return
end
switch $argv[1]
case ps
dops $argv[2..-1]
case '*'
command docker $argv[1..-1]
end
end