Linux command
alt 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Find
alt [path/to/file.rb]
Find
alt --truncate [1] [path/to/file.rb]
Find
alt -a [path/to/file.rb]
Find
find . -type f -print | alt -f - [path/to/file.rb]
说明
alt finds the "alternate file" for a given source file, typically switching between implementation and test files. It ranks all files in the project by similarity to the given path and outputs them in ranked order. For example, given app/models/user.rb, it would find test/models/user_test.rb or spec/models/user_spec.rb. This makes it easy to jump between code and tests in editor integrations such as Vim, NeoVim, and VS Code. By default, alt ignores hidden directory entries, globs defined in a .ignore file, and globs defined in the project's .gitignore and global .gitignore.
参数
- -a
- Include hidden files and directories in the search.
- -f _-_
- Read file paths from standard input instead of scanning the directory.
- -t _N_, --truncate _N_
- Truncate output to N alternate files (default 0, meaning show all).
- -v, --version
- Display version information.
- -h, --help
- Display help information.
FAQ
What is the alt command used for?
alt finds the "alternate file" for a given source file, typically switching between implementation and test files. It ranks all files in the project by similarity to the given path and outputs them in ranked order. For example, given app/models/user.rb, it would find test/models/user_test.rb or spec/models/user_spec.rb. This makes it easy to jump between code and tests in editor integrations such as Vim, NeoVim, and VS Code. By default, alt ignores hidden directory entries, globs defined in a .ignore file, and globs defined in the project's .gitignore and global .gitignore.
How do I run a basic alt example?
Run `alt [path/to/file.rb]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a do in alt?
Include hidden files and directories in the search.