Skip to content

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

Merged
fdncred merged 10 commits into
nushell:mainfrom
39555:port-before_v0.60/fun
May 13, 2024
Merged

fdncred merged 10 commits into
nushell:mainfrom
39555:port-before_v0.60/fun

Conversation

@39555

@39555 39555 commented May 12, 2024 •

Copy link
Copy Markdown

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

Igor 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
@fdncred

fdncred commented May 13, 2024

Copy link
Copy Markdown
Contributor

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.

2 participants