Conversation
sleep/src/main.rs
Outdated
| None => { | ||
| eprintln!("sleep: Missing operand.\nTry 'sleep --help' for more information."); | ||
| process::exit(1); | ||
| process::exit(1);2 |
There was a problem hiding this comment.
Be careful with this, remember to check compiling for the whole workspace
There was a problem hiding this comment.
Okay... sorry about that. Must have commited that by accident.
|
For next commits follow the git commit message guideline please |
seq/src/seq.yml
Outdated
| [OPTIONS] <FIRST> <INCREMENT> <LAST> | ||
| args: | ||
| - FIRST: | ||
| help: > |
There was a problem hiding this comment.
When possible, use single line string
There was a problem hiding this comment.
Alright, will apply that to the remaining single help values
seq/src/main.rs
Outdated
|
|
||
| fn next(&mut self) -> Option<Self::Item> { | ||
| if self.step.is_sign_positive() && self.current <= self.stop { | ||
| let result = self.current.clone(); |
There was a problem hiding this comment.
f64 is Copy, so you don't need to clone
seq/src/main.rs
Outdated
| self.current += self.step; | ||
|
|
||
| Some(result) | ||
| } else if self.step.is_sign_negative() && self.current >= self.stop |
There was a problem hiding this comment.
The logic of the inside this else if is the same as the first if logic, it's that right? If so, you could just use logical OR (||) on the first if and remove this else if
There was a problem hiding this comment.
Yeah, I refactored this to be one if condition since they are the same.
seq/src/main.rs
Outdated
|
|
||
| use clap::{load_yaml, App, AppSettings}; | ||
|
|
||
| #[derive(Clone,Debug)] |
There was a problem hiding this comment.
Since they are all small Copy types, you could also derive Copy
|
Running Which is expected when creating floating point sequences because of how floating point numbers are added or subtracted. To address this precision loss, I'm planning to use |
4fc24b8 to
d6ba949
Compare
|
As part of the PR, I have to run the > cargo fmt -p seq
Could not parse TOML: expected an equals, found a newline at line 3So checking out line 3 of ...
# Could not parse TOML: expected an equals, found a newline at line 3
make_backup
...
# Could not parse TOML: duplicate key: `wrap_comments`
wrap_comments = true
# Could not parse TOML: invalid escape character in string: `y` at line 54
license_template_path = "Copyright {\y} Eric Shimizu Karbstein."
,,,
# invalid type: integer `2018`, expected string for key `edition`
edition = 2018Commenting those lines, produces an error: Warning: can't set `skip_children = false`, unstable features are only available in nightly channel.I was able to make it run with |
|
I think it's ok to use nightly just for formatting Also, I'm ok with adding crates when makes sense, and your use makes sense, but try to keep on a minimum |
|
@GrayJack I'm at a crossroad. Currently looking at implementing I came across runtime-fmt that may be a solution but requires Any suggested direction or idea for my dilemma? |
|
Still, using printf from c would require unsafe, so I don't think you should use them |
|
So I should parse the Using this as a reference for the format |
|
Yeah, I think at one point it will be in the coreutil_core, since |
|
Sorry I did not understand, what do you mean by "copy&paste plus additions"? |
|
Copy and paste the formatting code from echo, add the cases that are missing (additions) |
Implement
seq.Drafted the PR to show progress and any possible early reviews if needed.
TODO:
seqoptions--format--separator--equal-width