nushell / nushell.github.io

Nushell's main website, blog, book, and more
https://www.nushell.sh/book/
MIT License
166 stars 408 forks source link

Add category backlinks #1312

Closed texastoland closed 5 months ago

texastoland commented 5 months ago

Looks bigger than it is. I'll break it down!

make_docs.nu

commands/README.md

commands/categories/*.md

commands/docs/*.md

[!WARNING] Changes below depend on next release โธ๏ธ

fdncred commented 5 months ago

One thing to keep in mind is that you can't just generate command in linux/mac, there are windows only commands.

/cc I'd like @hustcer to approve and land since he does a great job maintaining the docs.

hustcer commented 5 months ago

The script fail to work for me on macOS:

Error: nu::shell::eval_block_with_input

  ร— Eval block failed with pipeline input
     โ•ญโ”€[/Users/hustcer/nu-docs/make_docs.nu:382:46]
 381 โ”‚     let commands_group = ($commands | group-by name)
 382 โ”‚     let unique_commands = ($commands_group | columns)
     ยท                                              โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€
     ยท                                                 โ•ฐโ”€โ”€ source value
 383 โ”‚     let unique_categories = ($commands | get category | uniq)
     โ•ฐโ”€โ”€โ”€โ”€

Error: nu::shell::eval_block_with_input

  ร— Eval block failed with pipeline input
     โ•ญโ”€[/Users/hustcer/nu-docs/make_docs.nu:378:11]
 377 โ”‚         scope commands
 378 โ”‚         | join (command-names) name
     ยท           โ”€โ”€โ”ฌโ”€
     ยท             โ•ฐโ”€โ”€ source value
 379 โ”‚         | sort-by category
     โ•ฐโ”€โ”€โ”€โ”€

Error: nu::shell::eval_block_with_input

  ร— Eval block failed with pipeline input
     โ•ญโ”€[/Users/hustcer/nu-docs/make_docs.nu:377:9]
 376 โ”‚     let commands = (
 377 โ”‚         scope commands
     ยท         โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€
     ยท                โ•ฐโ”€โ”€ source value
 378 โ”‚         | join (command-names) name
     โ•ฐโ”€โ”€โ”€โ”€

Error: nu::shell::cant_convert

  ร— Can't convert to string.
     โ•ญโ”€[/Users/hustcer/nu-docs/make_docs.nu:214:63]
 213 โ”‚             | each { |example|
 214 โ”‚                 let result = (do -i { $example.result | try { table --expand } catch { $in } } )
     ยท                                                               โ”€โ”€โ”ฌโ”€โ”€
     ยท                                                                 โ•ฐโ”€โ”€ can't convert binary to string
 215 โ”‚ $"($example.description)
     โ•ฐโ”€โ”€โ”€โ”€

My version info:

 version              0.91.1
 branch               nightly
 commit_hash          cc8f2b6419daa7c5c55fb8ca0ef257fc76be6674
 build_os             macos-x86_64
 build_target         x86_64-apple-darwin
 rust_version         rustc 1.75.0 (82e1608df 2023-12-21)
 rust_channel         1.75.0-x86_64-apple-darwin
 cargo_version        cargo 1.75.0 (1d8b05cdd 2023-11-20)
 build_time           2024-03-22 01:31:28 +00:00
 build_rust_channel   release
 allocator            mimalloc
 features             dataframe, default, sqlite, static-link-openssl, trash, which
 installed_plugins    formats, gstat, inc, query
texastoland commented 5 months ago

Hmmm I'm on release build I'll check nightly soon ๐Ÿ‘๐Ÿผ

texastoland commented 5 months ago

Hmmm I'm on release build I'll check nightly soon ๐Ÿ‘๐Ÿผ

I was indeed able to repro with nightly. But it happens on main too:

nushell.github.io on ๏˜ main [โ‡•] is ๓ฐ— v0.0.0 via ๎œ˜ v21.6.1 took 4s
โฏ nu make_docs.nu
Error: nu::shell::eval_block_with_input

  ร— Eval block failed with pipeline input
     โ•ญโ”€[/Users/texas/Developer/nushell.github.io/make_docs.nu:368:46]
 367 โ”‚     let commands_group = ($commands | group-by name)
 368 โ”‚     let unique_commands = ($commands_group | columns)
     ยท                                              โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€
     ยท                                                 โ•ฐโ”€โ”€ source value
 369 โ”‚     let unique_categories = ($commands | get category | uniq)
     โ•ฐโ”€โ”€โ”€โ”€

Error: nu::shell::eval_block_with_input

  ร— Eval block failed with pipeline input
     โ•ญโ”€[/Users/texas/Developer/nushell.github.io/make_docs.nu:363:9]
 362 โ”‚     let commands = (
 363 โ”‚         scope commands
     ยท         โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€
     ยท                โ•ฐโ”€โ”€ source value
 364 โ”‚         | where is_custom == false and is_extern == false
     โ•ฐโ”€โ”€โ”€โ”€

Error: nu::shell::eval_block_with_input

  ร— Eval block failed with pipeline input
     โ•ญโ”€[/Users/texas/Developer/nushell.github.io/make_docs.nu:363:9]
 362 โ”‚     let commands = (
 363 โ”‚         scope commands
     ยท         โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€
     ยท                โ•ฐโ”€โ”€ source value
 364 โ”‚         | where is_custom == false and is_extern == false
     โ•ฐโ”€โ”€โ”€โ”€

Error: nu::shell::cant_convert

  ร— Can't convert to string.
     โ•ญโ”€[/Users/texas/Developer/nushell.github.io/make_docs.nu:200:63]
 199 โ”‚             | each { |example|
 200 โ”‚                 let result = (do -i { $example.result | try { table --expand } catch { $in } } )
     ยท                                                               โ”€โ”€โ”ฌโ”€โ”€
     ยท                                                                 โ•ฐโ”€โ”€ can't convert binary to string
 201 โ”‚ $"($example.description)
     โ•ฐโ”€โ”€โ”€โ”€

nushell.github.io on ๏˜ main [!?โ‡•] is ๓ฐ— v0.0.0 via ๎œ˜ v21.6.1 took 5s
โฏ version
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ version            โ”‚ 0.91.1                                   โ”‚
โ”‚ branch             โ”‚ main                                     โ”‚
โ”‚ commit_hash        โ”‚ b2c5dc204a851c7d2a7cd07b2b3157ba9e1f2173 โ”‚
โ”‚ build_os           โ”‚ macos-x86_64                             โ”‚
โ”‚ build_target       โ”‚ x86_64-apple-darwin                      โ”‚
โ”‚ rust_version       โ”‚ rustc 1.75.0 (82e1608df 2023-12-21)      โ”‚
โ”‚ rust_channel       โ”‚ 1.75.0-x86_64-apple-darwin               โ”‚
โ”‚ cargo_version      โ”‚ cargo 1.75.0 (1d8b05cdd 2023-11-20)      โ”‚
โ”‚ build_time         โ”‚ 2024-03-25 21:20:31 -05:00               โ”‚
โ”‚ build_rust_channel โ”‚ release                                  โ”‚
โ”‚ allocator          โ”‚ mimalloc                                 โ”‚
โ”‚ features           โ”‚ dataframe, default, sqlite, trash, which โ”‚
โ”‚ installed_plugins  โ”‚ explore                                  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

nushell.github.io on ๏˜ main [!?โ‡•] is ๓ฐ— v0.0.0 via ๎œ˜ v21.6.1
โฏ git log -n 1 -- make_docs.nu
commit 9a2a1191d5196ea74020390e38221902d9b2b4b0434^G
Author: Stefan Holderbach <sholderbach@users.noreply.github.com>
Date:   Sun Mar 10 17:29:54 2024 +0100

    Remove feature `extra` detection from make_docs.nu (#1294)

    If we sunset the `--features extra` for building Nushell we don't need
    to warn in upcoming releases anymore.

    Depends on https://github.com/nushell/nushell/pull/12140

    cc @hustcer: Does this simplify the command generation enough so that we
    don't need a parallel clone of the main repo anymore (you run it
    locally, right?)

@fdncred It's either a regression or breaking change. I'm investigating now and will report an issue in Nushell and/or PR a separate workaround ASAP.

AFAIK this and #1310 are ready to ๐Ÿšข

texastoland commented 5 months ago

Minimal repro:

โฏ let repro = scope commands | where name == 'bits and' | get examples.0.result

โฏ $repro | each { describe }
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ 0 โ”‚ int          โ”‚
โ”‚ 1 โ”‚ binary       โ”‚
โ”‚ 2 โ”‚ list<int>    โ”‚
โ”‚ 3 โ”‚ list<binary> โ”‚
โ”‚ 4 โ”‚ binary       โ”‚
โ”‚ 5 โ”‚ binary       โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โฏ $repro | each { table }
Error: nu::shell::cant_convert

  ร— Can't convert to string.
   โ•ญโ”€[entry #1:1:17]
 1 โ”‚ $repro | each { table }
   ยท                 โ”€โ”€โ”ฌโ”€โ”€
   ยท                   โ•ฐโ”€โ”€ can't convert binary to string
   โ•ฐโ”€โ”€โ”€โ”€

โฏ $repro.1 | table
Length: 2 (0x2) bytes | printable whitespace ascii_other non_ascii
00000000:   89 89                                                ร—ร—

โฏ $repro.1 | to nuon
0x[8989]

โฏ 0x[8989] | table
Length: 2 (0x2) bytes | printable whitespace ascii_other non_ascii
00000000:   89 89                                                ร—ร—

โฏ 0x[8989] | each { table }
Length: 2 (0x2) bytes | printable whitespace ascii_other non_ascii
00000000:   89 89                                                ร—ร—

โฏ [0x[8989]] | each { table }
Error: nu::shell::cant_convert

  ร— Can't convert to string.
   โ•ญโ”€[entry #1:1:21]
 1 โ”‚ [0x[8989]] | each { table }
   ยท                     โ”€โ”€โ”ฌโ”€โ”€
   ยท                       โ•ฐโ”€โ”€ can't convert binary to string
   โ•ฐโ”€โ”€โ”€โ”€

โฏ /usr/local/bin/nu -n -c '[0x[8989]] | each { table }'
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ 0 โ”‚ Length: 2 (0x2) bytes | printable whitespace ascii_other non_ascii  โ”‚
โ”‚   โ”‚ 00000000:   89 89                                                ร—ร— โ”‚
โ”‚   โ”‚                                                                     โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โฏ for $it in [0x[8989]] { $it | table | print }

โฏ for $it in [0x[8989]] { $it | print }
Length: 2 (0x2) bytes | printable whitespace ascii_other non_ascii
00000000:   89 89                                                ร—ร—

It's either a regression or breaking change. I'm investigating now and will report an issue in Nushell and/or PR a separate workaround ASAP.

Both incoming ๐Ÿ‡๐Ÿผ

fdncred commented 5 months ago

AFAIK this and https://github.com/nushell/nushell.github.io/pull/1310 are ready to ๐Ÿšข

I'm not sure why we'd land this if we know that the script doesn't work.

texastoland commented 5 months ago

But it happens on main too:

@fdncred The scripts in the website's main branch are also broken using Nu nightly:

Nu version before PR after PR
release (Homebrew) โœ”๏ธ โœ”๏ธ
nightly (commit hashes above) โŒ โŒ

Continuing in nushell/nushell#12287. This PR doesn't introduce changes related to that error.

texastoland commented 5 months ago

@hustcer The script fail to work for me on macOS:

Resolved in nushell/nushell#12294. Should work again with latest Nu build ๐Ÿš€

@fdncred Pending release then we (I don't currently have Windows set up) should run the script again.

IFL there's a way to automate by scheduling jobs on Nu release in VMs for both OSs ๐Ÿ’ญ Already explored?

hustcer commented 5 months ago

@texastoland There are some new commands that haven't been release yet:

A       commands/docs/debug_profile.md
A       commands/docs/plugin.md
A       commands/docs/plugin_list.md
A       commands/docs/plugin_stop.md
A       commands/docs/pwd.md
A       commands/docs/uname.md

We should remove the docs for these commands, or just submit make_doc.nu in this PR, or wait until v0.92 been released

texastoland commented 5 months ago

Changes below depend on next release โธ๏ธ

Thanks I added a notice to the description ๐Ÿ™๐Ÿผ

hustcer commented 5 months ago

@texastoland Don't forget upgrade to v0.92 after it was released and regenerate the docs again, then we can land this PR.

texastoland commented 5 months ago

Updated :shipit: