Skip to main content

Include

Legacy include tagsโ€‹

.aliae.yaml
aliae: !include "{{ .Home }}/.aliae/aliases.yaml"
env: !include_dir "{{ .Home }}/.aliae/envs"
$HOME/.aliae/aliases.yaml
- name: g
value: git
- name: k
value: kubectl

The !include and !include_dir yaml tags allow you to include a single file or a directory of .yaml files respectively. This allows for clean organization of aliae, envs, and all other things handled by Aliae. File/Directory paths support templating.

Inline Includeโ€‹

If you want to have a more fine grained control over the included file, you can use the !include tag inline in combination with other defined aliases.

.aliae.yaml
aliae:
- !include "{{ .Home }}/.aliae/kubernetes.yaml"
- name: g
value: git
$HOME/.aliae/kubernetes.yaml
- name: k
value: kubectl
- name: kg
value: kubectl get
- name: kgpo
value: kubectl get pod
- name: ksysgpo
value: kubectl --namespace=kube-system get pod
- name: krm
value: kubectl delete
- name: krmf
value: kubectl delete -f
- name: krming
value: kubectl delete ingress
- name: krmingl
value: kubectl delete ingress -l
- name: krmingall
value: kubectl delete ingress --all-namespaces
- name: kgsvcoyaml
value: kubectl get service -o=yaml
- name: kgsvcwn
value: kubectl get service --watch --namespace
- name: kgsvcslwn
value: kubectl get service --show-labels --watch --namespace
- name: kgwf
value: kubectl get --watch -f

Extendsโ€‹

The extends key allows you to extend an existing configuration. This is useful when you want to build on a shared base config without duplicating settings.

Each extends entry is loaded first, in order. The current file is processed last.

Short syntaxโ€‹

.aliae.yaml
extends:
- ./somepath.yml

alias:
- name: g
value: git

Long syntaxโ€‹

.aliae.yaml
extends:
- path: ./somepath.yml
failOnMissing: true # default: true
if: 'eq .Shell "bash"' # default: load (when omitted)

- dir: ./somepath/
recursive: false # default: false
failOnMissing: true # default: true

- path: ./somepath-2.yml

Merge behaviorโ€‹

  • Extended files are merged in declaration order.
  • Then the current config is merged on top.
  • List sections (alias, env, path, cdpath, script, link) are appended in that order.
  • Scalar settings (for example stat_timeout) are replaced by the last non-zero value encountered.

Notes and limitsโ€‹

  • extends supports both .yml and .yaml files.
  • dir entries are processed in alphabetical order and the ordering is case-sensitive.
  • recursive: true scans subdirectories.
  • failOnMissing: false skips missing files or directories for that entry.
  • if can be added to an extends entry; when it evaluates to false, that entry is skipped.
  • Cycles in extends are rejected.
  • Extends nesting depth is limited to 10 levels.