diff --git a/podman-directives.txt b/podman-directives.txt new file mode 100644 index 0000000..9b92e20 --- /dev/null +++ b/podman-directives.txt @@ -0,0 +1,113 @@ +AddCapability +AddDevice +AllTags +Annotation +Arch +AuthFile +AutoUpdate +CertDir +ConfigMap +ContainerName +ContainersConfModule +Copy +Creds +DecryptionKey +Device +DisableDNS +DNS +DNSOption +DNSSearch +Driver +DropCapability +Entrypoint +Environment +EnvironmentFile +EnvironmentHost +Exec +ExitCodePropagation +ExposeHostPort +File +ForceRM +Gateway +GIDMap +GlobalArgs +Group +GroupAdd +HealthCmd +HealthInterval +HealthOnFailure +HealthRetries +HealthStartPeriod +HealthStartupCmd +HealthStartupInterval +HealthStartupRetries +HealthStartupSuccess +HealthStartupTimeout +HealthTimeout +HostName +Image +ImageTag +Internal +IP +IP6 +IPAMDriver +IPRange +IPv6 +KubeDownForce +Label +LogDriver +LogOpt +Mask +Mount +Network +NetworkAlias +NetworkName +NoNewPrivileges +Notify +Options +OS +PidsLimit +Pod +PodmanArgs +PodName +PublishPort +Pull +ReadOnly +ReadOnlyTmpfs +RemapGid +RemapUid +RemapUidSize +RemapUsers +Rootfs +RunInit +SeccompProfile +Secret +SecurityLabelDisable +SecurityLabelFileType +SecurityLabelLevel +SecurityLabelNested +SecurityLabelType +SetWorkingDirectory +ShmSize +StopSignal +StopTimeout +SubGIDMap +Subnet +SubUIDMap +Sysctl +Target +Timezone +TLSVerify +Tmpfs +Type +UIDMap +Ulimit +Unmask +User +UserNS +Variant +VolatileTmp +Volume +VolumeName +WorkingDir +Yaml diff --git a/systemd.el b/systemd.el index 6db0403..f3abe65 100644 --- a/systemd.el +++ b/systemd.el @@ -127,11 +127,29 @@ (split-string (buffer-string)))) "Namespace container configuration directives for systemd.") +(defconst systemd-podman-sections + '("Build" "Container" "Image" "Kube" "Pod" "Volume") + "Namespace container configuration sections for Podman Quadlets. +See the man page `podman-systemd.unit(5)' for more details.") + +(defconst systemd-podman-directives + (eval-when-compile + (with-temp-buffer + (insert-file-contents + ;; https://github.com/containers/podman/blob/590445ce9d280fab3490b1009d6321533be36399/pkg/systemd/quadlet/quadlet.go#L53 + (let ((f "podman-directives.txt")) + (if (null load-file-name) f + (expand-file-name f (file-name-directory load-file-name))))) + (split-string (buffer-string)))) + "Namespace container configuration directives for Podman Quadlets. +See the man page `podman-systemd.unit(5)' for more details.") + ;;;###autoload (defconst systemd-autoload-regexp (rx (+? (any "a-zA-Z0-9-_.@\\")) "." (or "automount" "busname" "mount" "service" "slice" - "socket" "swap" "target" "timer" "link" "netdev" "network") + "socket" "swap" "target" "timer" "link" "netdev" "network" + "build" "container" "image" "kube" "pod" "volume") string-end) "Regexp for file buffers in which to autoload `systemd-mode'.") @@ -140,7 +158,8 @@ (rx ".#" (or (and (+? (any "a-zA-Z0-9-_.@\\")) "." (or "automount" "busname" "mount" "service" "slice" - "socket" "swap" "target" "timer" "link" "netdev" "network")) + "socket" "swap" "target" "timer" "link" "netdev" "network" + "build" "container" "image" "kube" "network" "pod" "volume")) "override.conf") (= 16 (char hex-digit)) string-end) "Regexp for temp file buffers in which to autoload `systemd-mode'.") @@ -219,11 +238,21 @@ file, defaulting to the link under point, if any." "Return non-nil if FILENAME has an nspawn extension, otherwise nil." (string-match-p (rx ".nspawn" string-end) filename)) +(defun systemd-file-podman-p (filename) + "Return non-nil if FILENAME has a Podman-related extension, otherwise nil." + (string-match-p (rx (or "build" "container" "image" "kube" "pod" "volume") + string-end) + filename)) + (defun systemd-completion-table (&rest _ignore) "Return a list of completion candidates." (let ((sectionp (systemd-buffer-section-p)) (name (buffer-name))) (cond + ((systemd-file-podman-p name) + (if sectionp + (append systemd-podman-sections systemd-unit-sections) + (append systemd-podman-directives systemd-unit-directives))) ((systemd-file-nspawn-p name) (if sectionp systemd-nspawn-sections systemd-nspawn-directives)) ((systemd-file-network-p name)