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

Add script for setting random wallpaper #1

Merged
merged 3 commits into from
Jan 23, 2021
Merged

Conversation

kubouch
Copy link
Contributor

@kubouch kubouch commented Jan 23, 2021

This PR adds a script for setting a random wallpaper from a directory and drawing custom overlay text over it.

Also proposes a table in the README with short descriptions of the scripts included.

@fdncred fdncred merged commit f3a1993 into nushell:main Jan 23, 2021
@fdncred
Copy link
Collaborator

fdncred commented Jan 23, 2021

i like your table and link. i'll have to do that for mine that i just added. thanks!

@kubouch kubouch deleted the fehbg branch January 23, 2021 19:28
@kubouch
Copy link
Contributor Author

kubouch commented Jan 23, 2021

It just came to my mind, we can change the table into better format later, if necessary.

@fdncred
Copy link
Collaborator

fdncred commented Jan 23, 2021

It would be nice to have a script to auto generate the readme table from files. Not sure exactly how to get it into the readme. Maybe just link to a table of contents md file from the readme?

@kubouch
Copy link
Contributor Author

kubouch commented Jan 23, 2021

This would be a perfect use case for nudoc. There could even be examples that could be ran as a CI job for example.

But for now, I think some header with required version and description would do (maybe other fields?). It could be a separate file but I think it's best if it's directly in README. In the README file, you could define e.g. toc_start and toc_end anchors (I've done this once but can't recall the exact syntax; anyway, these anchors are invisible in the rendered README). The table of contents would then overwrite all lines between the two anchors.

For example, the header could be denoted by ## (the name field is not necessary since you can just use the file name):

#!/usr/bin/env nu
#
## version: 0.25.1
## description: Short description what this script does.
#
# Longer description that doesn't go to README
# ...

def do_stuff[stuff] {
}
...

Then, to generate the entries, you'd run:

open MyScript.nu | lines | where $(str starts-with '##') | str ltrim -c '#' | split column ':' 

It might need some pivot so you can collect from more files. Nushell can already format to .md so generating a table should be simple. Then you'd insert it into README between the two anchors. Generating the link to the file should also be simple since you iterate over them so you'd use $it and path commands.

Not sure if it's worth the effort but might be a fun nu exercise :-D .

@fdncred
Copy link
Collaborator

fdncred commented Jan 23, 2021

I do also agree that it would be overkill but I'd love for there to be multiple overkill scripts in here. I want to show off what nushell and nu can do as a language and how big scripts can be refactored into multiple custom commands.

fdncred pushed a commit that referenced this pull request Jan 10, 2024
This is a (probably crude) attempt to address an issue where using the
`gh status` command with gh completions installed would yield the
following error:

```
> gh status
Error: nu::parser::missing_positional

  × Missing required positional argument.
   ╭─[entry #1:1:1]
 1 │ gh status
   ╰────
  help: Usage: gh status {flags} <command> . Use `--help` for more information.
```
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