Replace scrut(1) with fileis(1) #146
No reviewers
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
joke
question
wontfix
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Depends on
#96 testing
bonsai/harakit
Reference: bonsai/harakit#146
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "libfileis"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #104.
This branch renames scrut(1) to fileis(1) as discussed in #104. Additionally, it rewrites fileis(1) in Rust.
Originally the branch was going to create a libfileis(3) which would be used from a Rust fileis(1), but it turns out every feature can be accomplished with the Rust standard library (thank you Emma for pointing this out) so I was able to rewrite it without making a library too.
I didn’t mean to close this.
Is there an issue describing what is happening in this PR?
WIP: libfileis(3)to fileis(1)fileis(1)to Replace scrut(1) with fileis(1)Should this program return
EX_IOERR
on line 59 andEX_SOFTWARE
on line 81?@trinity: In the middle of this review I decided to simply make a patch and send it your way via instant messaging.
@ -0,0 +37,4 @@
fn main() -> ExitCode {
let argv = args().collect::<Vec<String>>();
let mut sel = String::from(""); // selected options
let mut sel = String::new();
I see now that line 81 should stay the same.
Line 59 happens when a file is non-existent, which means it's failed the test.
I see now that line 59 should stay the same.
@ -0,0 +55,4 @@
if optind == argv.len() { return usage(&argv[0]); }
for arg in argv.iter().skip(optind) {
let fmeta = match metadata(arg) {
I would rather have declarations precede assignments here. I understand assignment on declaration is idiomatic in Rust. Python, in fact, due to its type system, mandated it. But I've been forced to separate them (often) in C, and, having used both styles, prefer the separation for clarity of code.
The separation decreases clarity, as it separates the context from the declaration of the variable. Separation should occur only when necessary, in my opinion.
firmly siding with emma on this. declaring variables at the top of the scope is an archaic convention imposed by the technical limitations of a bygone era. variables should, for readability's sake, generally be declared either near or at the site of their assignment, not way up at the top of the function (and in an entirely different scope!!).
the note about scoping is actually more significant now that we're arguing about rust instead of c. the rust compiler is able to do a far better job at optimization if you stick to sane conventions and, as far as i'm aware (and please do correct me if i'm mistaken), this is one of those cases where things end up better-optimized if you write normal rust code instead of fortran.
I disagree with the form but can't help agreeing with the compilation benefits.
Checkout
From your project repository, check out a new branch and test the changes.