1 个稳定版本

1.0.0 2020年11月15日

#5 in #保留

MIT 许可证

22KB
380 代码行

def

def 是一个小的跟踪文件和目录描述的工具。它通过将路径映射到描述,存储在配置文件中,并在需要时检索它来工作。

安装

cargo install def

用法

def keeps track of file and directory descriptions for you.

Usage

  def <path>                        Print description of file/dir at path.
  def add <path> <description>      Add a description for file/dir at path.
  def pattern <path> <description>  Add a pattern to describe children of dir. A
                                    wildcard in the pattern will be replaced with
                                    the child's name.

Descriptions

  To describe a file or directory use add sub-command which simply maps a description
  to an absolute path.

  The pattern sub-command is used to describe all children of a directory using a
  common trait. When pattern is used, a description is mapped to a dir, but is used
  only to describe its children. If a wildcard "*" exists in the pattern, it will
  be replaced by the child's name.

  For example:

  $ def pattern dir "* is a child of dir"
  $ def dir/temp
  /path/to/dir/temp: temp is a child of dir

Descriptions and patterns are kept in ~/.config/def/config.json which maps each
description to an absolute path and can be added to or adjusted manually.

示例

$ def add path/directory "This is a directory."
$ def pattern path/directory "* is a child of path/directory."

$ def path/directory
/absolute/path/directory: This is a directory.

$ cd path/directory
$ def temp.txt  # wildcard is replaced by child's name (temp.txt).
/absolute/path/directory/temp.txt: temp.txt is a child of path/directory

依赖

~0.7–12MB
~89K SLoC