跳转至

磁盘路径

disk-path 使用 df -h 显示指定路径的磁盘使用情况。它是可直接用于按钮的 随附函数之一。

  • 运行:df -h {{.path}}
  • path(可选,默认/):要检查的文件系统路径

函数文件

functions/disk-path.yaml
name: disk-path
run: "df -h {{.path}}"
params:
  - name: path
    type: string
    required: false
    default: "/"
    description: Filesystem path to check

由于 path 可选且有默认值,按钮省略它后仍可正常工作。

使用默认路径或选择一个

Disk usage buttons
- name: Disk (root)
  type: button
  function: disk-path        # 没有 path 字段:使用默认值 "/"
- name: Disk (var)
  type: button
  function: disk-path
  path: "/var"

第一个按钮运行 df -h /,第二个按钮运行 df -h /var。

相关