-
Notifications
You must be signed in to change notification settings - Fork 36
Implemented initial version of whereis #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does Wh
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(""); |
Copilot uses AI. Check for mistakes.
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_dirs
Future work could include:
uu_app
function where naming is concerned.I am happy to iterate further based on feedback!