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

Port before_v0.60/fun folder (issue #221) #835

Merged
merged 10 commits into from
May 13, 2024

Conversation

39555
Copy link
Contributor

@39555 39555 commented May 12, 2024

This PR is part of porting all old scripts #221 and ports fun folder

Summary

star.nu

from: before_v0.60/fun/star.nu
to: modules/fun/star.nu

spark.nu

The script has already been ported. I've removed old version.

from: before_v0.60/fun/spark.nu
to: sourced/fun/spark.nu
functions:
  spark: sourced/fun/spark.nu:1:spark

life.nu

from: before_v0.60/fun/life.nu
to: modules/fun/life.nu

lisp_mode.nu

There is a problem with this module because - is not allowed in names anymore, however def "-" is a valid syntax, but you will be unable to call this function.

from: before_v0.60/fun/lisp_mode.nu
to: sourced/fun/lisp_mode.nu

nyancat.nu

I also fixed animation frames from https://github.com/klange/nyancat

from: before_v0.60/fun/nyancat.nu
to: modules/fun/nyancat.nu

39555 added 10 commits May 12, 2024 19:13
`def "-" [x, y] { $x - $y }` is a valid syntax but apparently function call not working anymore.
another functions work well. I wrap them in "" anyway
`before_v0.60/fun/life.nu` -> `modules/fun/life.nu`
- rename all `-` in variable names to `_`
- replace `nth` with `get`
- replace `$true` and `$false` with `true`, `false`
- add `else` to `if {} {}`
- replace pipeline `for` with `each {|x|...}`
- replace the table `[[width height data]; ...]` with record `{ width:..., height: ..., data:...}` because there is only one record. (old `nu` was making automatic dereference)
- `str collect` with `str join`
- `echo` with `print`
- clear screen with `clear`
- remove unnecessary `char nl`
- remove `main` call at the end
`before_v0.60/fun/nyancat.nu` -> `modules/fun/nyancat.nu`
- fix frames content: strange `and` to '&'
- replace removed `char` subcommands
- make `frames` as a list
- `for -n` and `nth $it.index` -> `for frame in $frames {}`
- just `print` each frame
- `ansi cls` to `clear`
- merge two variants: print each frame at a time
- implement missing `atan2`
- use std math `$math.PI`
- remove `autoview`
- fix renamed fields in `(term size)`
already ported to `sourced/fun/spark.nu`
@fdncred fdncred merged commit 2fe0756 into nushell:main May 13, 2024
1 check failed
@fdncred
Copy link
Collaborator

fdncred commented May 13, 2024

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants