Files
Netcatty/electron/specs/date.js
T
csr588 39d86adaed feat(autocomplete): ship a GNU date spec for Linux-first completion
The bundled Fig date spec follows BSD/macOS flags (-j, -n, -t, -v, epoch
seconds for -r), so Linux hosts were offered options that do not exist there.
Local specs already override the bundled package, so add electron/specs/date.js
with the GNU option set: -d/--date, --debug, -f/--file, -I/--iso-8601,
-R/--rfc-email, --rfc-3339, -r/--reference, -s/--set, -u/--utc, plus the
+FORMAT operand.

- Translate the 13 new descriptions; zh-TW is regenerated from them.
- Remove the 13 BSD-only date entries after a repository-wide scan showed no
  other spec references them.
- Resolve local specs first in the batch 4 test, matching runtime and the
  untranslated-description audit, and spot-check the new GNU wording.
2026-11-07 23:48:37 +08:00

62 lines
2.4 KiB
JavaScript

// date spec — GNU coreutils date (Linux hosts). The bundled Fig spec follows
// BSD/macOS flags (-j, -n, -t, -v) that GNU date does not have, so this local
// spec describes the GNU option set instead. Local specs win over the bundled
// package at runtime and in the translation audit.
const completionSpec = {
name: "date",
description: "Display or set date and time",
options: [
{
name: ["-d", "--date"],
description: "Display the date and time described by the given string instead of the current time",
args: { name: "string", description: "Date string, for example '2024-01-01 12:00:00' or 'next friday'" },
},
{
name: "--debug",
description: "Annotate the parsed date and warn about questionable usage on standard error",
},
{
name: ["-f", "--file"],
description: "Parse each line of the given file like --date",
args: { name: "datefile", description: "File with one date string per line" },
},
{
name: ["-I", "--iso-8601"],
description: "Output an ISO 8601 date/time string; the optional format is date, hours, minutes, seconds or ns",
args: { name: "format", isOptional: true, suggestions: ["date", "hours", "minutes", "seconds", "ns"] },
},
{
name: ["-R", "--rfc-email"],
description: "Output an RFC 5322 email-style date and time string",
},
{
name: "--rfc-3339",
description: "Output an RFC 3339 date/time string in the given format",
args: { name: "format", suggestions: ["date", "seconds", "ns"] },
},
{
name: ["-r", "--reference"],
description: "Display the last modification time of the given file",
args: { name: "file", description: "File whose modification time is displayed" },
},
{
name: ["-s", "--set"],
description: "Set the system time from the given string",
args: { name: "string", description: "Date string to set the system clock to" },
},
{
name: ["-u", "--utc", "--universal"],
description: "Display or set the date in UTC (Coordinated Universal) time",
},
{ name: "--help", description: "Display help text" },
{ name: "--version", description: "Display version information" },
],
args: {
name: "+FORMAT",
description: "Output format beginning with '+', using strftime escapes such as +%Y-%m-%d",
isOptional: true,
},
};
export default completionSpec;