coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

Implement seq

Open GrayJack opened this issue 5 years ago • 10 comments

This is a tracking issue for the seq util.

Required options and flags:

  • [ ] f (long: format)
  • [X] s (long: separator)
  • [ ] t (long: terminator)
  • [X] w (long: equal-width, visible-alias: fixed-width)

Notes: ¹ : Long name not defined on other implementation of this utility. Implementer must choose a long name. ² : Short name (one letter) not defined on other implementation of this utility. Implementer must choose. a short name

References

Seq Linux Seq FreeBSD Seq NetBSD Seq DragonflyBSD

Unresolved questions:

None yet

History

The -w and -s were implemented by #125 Open issue for -f: #127

GrayJack avatar Sep 27 '19 20:09 GrayJack

Hi, planning to work on this issue. Planning to do the following:

  1. Create a branch, cli/seq from master
  2. Create a seq member based on sleep
  3. Replicate man seq in terms of options and documentation
  4. Write code

Any other advice or guidelines such as testing as well?

FrancisMurillo avatar Sep 29 '19 13:09 FrancisMurillo

Yes one advice

Always drop manually everything that needs to when std::process::exit()

As for testing, I do not have something more strict because we have lots of stuff that the result depends on the running system configuration, and I have no idea how to create tests for these cases.

But overall, everything that are not those cases, I would like tests cases. I usually give very descriptive names for test functions like <function name>_<case>

Example: I have a function called myfunc that takes one bool parameter, so my test function names would be myfunc_true and myfunc_false

I guess that's all that I can think on top of my head

Have fun with the project :smile:

GrayJack avatar Sep 29 '19 16:09 GrayJack

Hi @GrayJack, not sure if @FrancisMurillo is working on this. I had few hours to work on this one, please review the PR -https://github.com/GrayJack/coreutils/pull/125

yehohanan7 avatar Aug 31 '20 14:08 yehohanan7

Just missing -f flag now

GrayJack avatar Sep 01 '20 09:09 GrayJack

I just notice that when all 3 args are the same (1 1 1, or 2 2 2) it wont print the value

With default seq

seq 1 1 1

Has output of 1

this version only exit without showing the number

GrayJack avatar Sep 01 '20 09:09 GrayJack

Heya, I'd like to take a crack at adding the -f flag and fixing this behavior so seq 1 1 1 operates as expected!

lynnpepin avatar Sep 26 '22 13:09 lynnpepin

Hi @GrayJack I couldn't reproduce the 1 1 1 problem from the dev branch.

Running seq 1 1 1 returns 1, as expected, when built using MacOS and Linux targets.

lynnpepin avatar Oct 01 '22 16:10 lynnpepin

Hi @lynnpepin, I believe the error in the behavior was fixed on PR #154 , but the -f flag remains unimplemented

Sorry, I forgot to mention here that the issue was fixed.

GrayJack avatar Oct 02 '22 02:10 GrayJack

Understood! Focusing on the -f flag

lynnpepin avatar Oct 05 '22 20:10 lynnpepin

Hey @GrayJack I'm going to call it quits on implementing -f. Couldn't figure it out, and I've definitely overcommited a bit! I think I need to tackle some more Rust before trying again.

As it stands, a good first issue for anyone else!

lynnpepin avatar Nov 01 '22 20:11 lynnpepin