Skip to content
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

feat: add randomizer function #9

Open
cybardev opened this issue Nov 16, 2023 · 5 comments
Open

feat: add randomizer function #9

cybardev opened this issue Nov 16, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@cybardev
Copy link
Owner

cybardev commented Nov 16, 2023

Description

We want a function in the script that uses shuf to randomize the animals and eyes. Currently we only have a note under the Extras section in the readme.

Code suggested by @Kalitsune in #8 (comment):

# welcome screen
fetch () {
  eyes=(0 1 2 3 4 6 7 8 11 12 14)
  cutefetch -k2 $(shuf -e "${eyes[@]}" -n 1)
}
fetch

This radomizes the eyes but not the animal. Ideally, we would also randomize the animal. Optionally, we can make it a flag with args, like -r eyes and -r animal, with the default -r and -r all having both effects.

Changes Requested

  • add randomizer function called randomfetch or randfetch
    (either is fine but I prefer randomfetch since it's more explicit and clear)
  • use two lists: one for eyes, one for animal
  • add randomizer flag that takes optional args to randomize eyes or animal
  • flag default (without args) should be to randomize both

Acceptance Criteria

  • randomizes animal with -r animal and --random animal flags
  • randomizes eyes with -r eyes and --random eyes flags
  • randomizes both with -r, -r all, --random, and --random all flags
  • existing features are unaltered and continue to work

Blockers

@Kalitsune
Copy link
Contributor

Kalitsune commented Nov 16, 2023

Suggestion:
Replacing the --animal argument by an option:

cutefetch <animal> <eyes>

(It doesn't make sense to have a --flag for this if you cant print two animals at once)

And accepting arrays as input:

cutefetch (bunny,kitty,doggy) (0, 1, 5, 12)

And if an array is passed as an input, have the program choose a random value in it

Of course, this could still be used without using the random feature like this:

cutefetch kitty2 12

@cybardev
Copy link
Owner Author

cybardev commented Nov 16, 2023

That makes a lot of sense. Thanks for the suggestions, @Kalitsune. I think changing the flags to args should be another issue since this issue is just about the randomizer, so I'll make a separate issue on that sometime soon.

Also, we should probably still have a "randomize from all" flag or argument, or maybe if <animal> and <eyes> are given "random" then we randomize that. Cuz it'd be cumbersome to list all available animals and eyes in args.

@Kalitsune
Copy link
Contributor

Sure. But if we're planning on changing the args its probably better not to start implementing the random yet to avoid having to reimplement it once the change is done

And yes, using "random" as an arg for randomize all makes a lot of sense we should do that!

@cybardev
Copy link
Owner Author

Alright. In that case, you can hold off making the randomizer for now in case you were planning to work on it.

I'll make a PR with the new argument parsing system and let you know when it's ready.

Thanks for your help and insight on these issues. Enjoy your day(s) 😊

@Kalitsune
Copy link
Contributor

Kalitsune commented Nov 16, 2023 via email

Repository owner deleted a comment from Bridgewaters01 Feb 2, 2024
Repository owner deleted a comment from jidalii Feb 26, 2024
Repository owner deleted a comment from jidalii Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants