Conversation
… for the whereis addition
…iginal whereis man page for documentation
… tests to go along with it
… are currently supported
| assert!(stdout.contains("/usr/bin/gcc")); | ||
|
|
||
| assert!(stdout.contains("/usr/lib/gcc")); | ||
| assert!(stdout.contains("/usr/share/gcc")); |
There was a problem hiding this comment.
This assert fails on my machine as there is no such folder.
|
|
||
| // Store the metadata for a file | ||
| #[derive(Serialize, Clone, Debug)] | ||
| pub struct WhDir { |
There was a problem hiding this comment.
The Wh is taken from the C source code. I suspect it just means WhereisDirectory since in the C source the list of paths is hardcoded. I think its there for significance of the paths that are used. https://github.com/util-linux/util-linux/blob/master/misc-utils/whereis.c
On Line 94 is the definition of the structure.
There was a problem hiding this comment.
Pull Request Overview
This PR implements the initial version of the whereis utility with basic functionality to locate binaries, source, and man pages.
- Basic implementation of whereis including tests and documentation
- Addition of test cases for various lookup options (binary, man, source)
- Updates to Cargo.toml files to include whereis in the workspace
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/tests.rs | Added mod inclusion for test_whereis in tests |
| tests/by-util/test_whereis.rs | Added several tests to verify whereis output |
| src/uu/whereis/whereis.md | Added documentation for the whereis utility |
| src/uu/whereis/src/main.rs | Bootstraps the whereis utility using uucore macro |
| src/uu/whereis/src/constants.rs | Defines constant arrays for directories used by whereis |
| src/uu/whereis/Cargo.toml | Defines the Cargo package for the whereis utility |
| Cargo.toml | Updated workspace dependencies to include whereis |
tests/by-util/test_whereis.rs
Outdated
| .arg("-s") | ||
| .arg("dig") | ||
| .succeeds() | ||
| .stdout_contains(""); |
There was a problem hiding this comment.
The assertion in the test_src_only test is ineffective because checking for an empty string always passes. Consider verifying against an expected output or removing the check if it is not necessary.
| .stdout_contains(""); | |
| .stdout_is(""); |
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
…nce its not installed by default and added the header for the file
…ore (MAN_DIRS, etc)
This PR focuses on basic functionality of the whereis utility.
Current Issues with the current implementation:
WhDirList::add_sub_dirsFuture work could include:
uu_appfunction where naming is concerned.I am happy to iterate further based on feedback!