-
Notifications
You must be signed in to change notification settings - Fork 232
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 a README generator #246
Conversation
README_template.md
Outdated
|
||
You can run Nushell scripts in a few different ways. | ||
|
||
1. You can type `nu <script name>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be good to have a blurb in here about what happens if you script has a def main [] { }
i.e. you can do nu script_name.nu --param1 --param2. last I checked we could do that with scripts that don't have main.
thanks for addressing #4, I think this looks good. |
I would like to implement a system that could read the scripts for some metadata (like a Description) and then put it inside the table. Any ideas on how metadata could be inserted into the scripts? |
if custom commands have a |
You might also be interested in parameter descriptions but I agree on that |
But what if scripts have multiple commands? |
We can develop a manifest template and encourage people to use it. Actually this is a must-have for developing a package manager, so it'd be a milestone |
For now you can do sth like: |
Okay so this is what I came up with: #?name: ~/.fehbg.nu
#?version: 1.0
#
#?short-desc: Selects a random image from a directory and sets it as a wallpaper
#
#? This script selects a random image from a directory and sets it as a
#? wallpaper. An additional feature is that it draws the path of the image in
#? the lower left corner which makes it easier to find the image later. Which would be parsed as: {
"name": "~/.fehbg.nu",
"version": "1.0",
"short-desc": "Selects a random image from a directory and sets it as a wallpaper",
"description": "This script selects a random image from a directory and sets it as a wallpaper. An additional feature is that it draws the path of the image in the lower left corner which makes it easier to find the image later."
} Basically all commands starting with |
Generally OK, but I suggest a few changes:
|
I agree with your first point. but all of the rest can be autogenerated.
|
Okay, agreed with author and autogeneration. Though I think that we should store the script's location in the repo ( |
I like where this is going. Also, I really always wanted to have script attribution somewhere, so it's nice to see that "author" can be added easily. I'm just wondering how this will work on all the existing scripts. I mean, is the plan to write some nushell script code to gather most of this information and populate it in the script files auto-magically? |
I think that everything (except for descriptions, of course) could be done "auto-magically". With versions, we can default to 1.0, while generating manifests Adding descriptions will take some time (like porting to engine-q) but we can force new PRs to comply with a template that we'll agree here on. |
When the template will be agreed on, we can provide a sample pre-commit hook that uses the script to generate manifests (will need 2 arguments: short and long descriptions), so the change will be as little painful as it can be |
very nice! |
Excellent work! Though I still think that |
Yeah yeah, i'll do that. Currently working on the auto generation for names, authors, etc. |
In that case I have nothing to add and just can't wait to see the results :) |
The auto-generation is working! In this image the following properties are auto-generated:
|
awesome! |
Should we move this generator into it's own directory? |
Imo yes, |
It's about time we start discussing the template and how it will look like, I'll start and we will make changes to the following template: #?type:
# script (A script that is run with `nu script.nu`)
# lib, libary (A libary meant to be `source`d by other files)
# config, cfg (A configuration file meant to be `source`d by a user, can also include commands)
#?name: (Autogenerated) The name of the file
#?display-name: A fancy name that can have spaces and such
#?version: The version of the script (Must be semantic aka {Major}.{Minor}.{Patch}) (Will be required for a future script package manager's update system)
#?short-desc: A short description with less than 75 characters.
#
#? Having no key makes it a part of the long description.
#? A description should have less than 500 characters. What do you think? |
Means the path to the file (for logical purposes)?
While this is the name for user-interface purposes, right? |
Besides that, I'd add |
No. That's a separate property which i forgot to mention called
Yes this is only for user-interface purposes.
Again, i forgor to mention that property 💀(It's autogenerated) |
Here's the new template then: #?type:
# script (A script that is run with `nu script.nu`)
# lib, libary (A libary meant to be `source`d by other files)
# config, cfg (A configuration file meant to be `source`d by a user, can also include commands)
#?name: (Autogenerated) The name of the file
#?path: (Autogenerated) The path to the file
#?script-url: (Autogenerated) https://github.com/nushell/nu_scripts/blob/main/{PATH TO SCRIPT}
#?script-raw-url: (Autogenerated) https://raw.githubusercontent.com/nushell/nu_scripts/main/{PATH TO SCRIPT}
#?authors: (Autogenerated) Fetched from Github API
#?display-name: A fancy name that can have spaces and such (For user interface purposes)
#?version: The version of the script (Must be semantic aka {Major}.{Minor}.{Patch}) (Will be required for a future script package manager's update system)
#?short-desc: A short description with less than 75 characters.
#
#? Having no key makes it a part of the long description.
#? A description should have less than 500 characters. |
Excellent, it can do imo |
I'm not sure if we should create both |
Also, @Dan-Gamin, if you're interested in the package manager, check out my thoughts about it. We can talk about it there or write something and create a draft PR here. Of course, I'm not forcing you to code anything but I'd be happy if you tell me what you think about the project :) |
What 3rd one? The |
@skelly37 Yeah I want to do that in the (hopefully near) future. I'll get started on that once this get's merged. |
|
Don't rush with that. A friend of mine has already written some code and promised to publish it this week, so it'd be useless to do the same job. I'll let you know when that happens |
After consulting my pillow:
|
@Dan-Gamin you can make metadata parsing 10x simpler by storing it in an inline yaml file inside the script
and then you can parse it with:
There is no need to use any custom parsing for the long description, yaml natively supports multiline strings with As for the readme generator itself it shouldn't use |
@Yethal thanks for the ferdback. I'll make changes soon. Hopefully. |
Are we ready to merge this or did we all get busy doing other things? |
@fdncred from my (nupac) point of view: We need required attributes supported, ref: https://github.com/skelly37/nupac/blob/main/docs/PACKAGE_MANIFEST.md Also, see the current way we handle repo cache generation: https://github.com/skelly37/nupac/blob/refactor-generate-repo-cachenu/generate-repo-cache.nu Needed attributes:
|
Sorry for all the mess with the attributes but everything gets more clear during the development process |
i totally understand. I'm good with landing what we have, at just about any point, and continuing to work on it with subsequent PRs. i.e. if this mostly works but still needs the things we want. We can land this and you can submit a different PR with those points you mentioned above. |
Closes #4.
This PR adds a script that generates a README with a table containing all the scripts in the repo.
Basically what is does is use a template to create the README and insert a table of all the scripts, It also excludes files from the
before_6.0
directory and thecustom-completions\auto-generate\completions
(aka the fish dump) directory.I also made the README better in general too with a few badges. Heres a preview: readme_generator_preview.md