mirror of
https://github.com/Cian-H/dotfiles.git
synced 2026-03-28 14:32:46 +00:00
Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows) and improves grepability with neovim/telescope
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use std log
|
||||
|
||||
def open-pr [
|
||||
repo: path
|
||||
remote: string
|
||||
pr: record<
|
||||
branch: string
|
||||
title: string
|
||||
body: string
|
||||
>
|
||||
] {
|
||||
cd $repo
|
||||
gh repo set-default $remote
|
||||
|
||||
log info "mock up pr"
|
||||
(
|
||||
gh pr create
|
||||
--head $pr.branch
|
||||
--base main
|
||||
--title $pr.title
|
||||
--body $pr.body
|
||||
--draft
|
||||
)
|
||||
}
|
||||
|
||||
def clean [repo: path] {
|
||||
log info "removing the repo"
|
||||
rm -rf $repo
|
||||
}
|
||||
|
||||
# open the release note PR interactively
|
||||
#
|
||||
# # Example
|
||||
# [this PR](https://github.com/nushell/nushell.github.io/pull/916) has been created with the script
|
||||
# > ./make_release/release-note/create-pr 0.81 2023-06-06
|
||||
def main [
|
||||
version: string # the version of the release, e.g. `0.80`
|
||||
date: datetime # the date of the upcoming release, e.g. `2023-05-16`
|
||||
] {
|
||||
let repo = ($nu.temp-path | path join (random uuid))
|
||||
let branch = $"release-notes-($version)"
|
||||
|
||||
let blog_path = (
|
||||
$repo | path join "blog" $"($date | format date "%Y-%m-%d")-nushell_($version | str replace --all '.' '_').md"
|
||||
)
|
||||
|
||||
let title = $"Release notes for `($version)`"
|
||||
let body = $"Please add your new features and breaking changes to the release notes
|
||||
by opening PRs against the `release-notes-($version)` branch.
|
||||
|
||||
## TODO
|
||||
- [ ] look at interesting contributions
|
||||
- [ ] write all the sections
|
||||
- [ ] order the sections by interest
|
||||
- [ ] add the breaking changes
|
||||
- [ ] detail the breaking changes
|
||||
- [ ] add the full changelog
|
||||
- [ ] complete all the `TODO`s inside the release note
|
||||
- [ ] ... \(PRs that need to land before the release, e.g. [deprecations]\(https://github.com/nushell/nushell/labels/deprecation\) or [removals]\(https://github.com/nushell/nushell/pulls?q=is%3Apr+is%3Aopen+label%3Aremoval-after-deprecation\)\)"
|
||||
|
||||
log info "creating release note from template"
|
||||
let release_note = $env.CURRENT_FILE
|
||||
| path dirname
|
||||
| path join "template.md"
|
||||
| open
|
||||
| str replace --all "{{VERSION}}" $version
|
||||
|
||||
log info $"branch: ($branch)"
|
||||
log info $"blog: ($blog_path | str replace $repo "" | path split | skip 1 | path join)"
|
||||
log info $"title: ($title)"
|
||||
|
||||
match (["yes" "no"] | input list --fuzzy "Inspect the release note document? ") {
|
||||
"yes" => {
|
||||
if $env.EDITOR? == null {
|
||||
error make --unspanned {
|
||||
msg: $"(ansi red_bold)$env.EDITOR is not defined(ansi reset)"
|
||||
}
|
||||
}
|
||||
|
||||
let temp_file = $nu.temp-path | path join $"(random uuid).md"
|
||||
$release_note | save --force $temp_file
|
||||
^$env.EDITOR $temp_file
|
||||
rm --recursive --force $temp_file
|
||||
},
|
||||
"no" | "" | _ => {},
|
||||
}
|
||||
|
||||
match (["no" "yes"] | input list --fuzzy "Open release note PR? ") {
|
||||
"yes" => {},
|
||||
"no" | "" | _ => {
|
||||
log warning "aborting."
|
||||
return
|
||||
},
|
||||
}
|
||||
|
||||
log info "setting up nushell.github.io repo"
|
||||
git clone https://github.com/nushell/nushell.github.io $repo --origin nushell --branch main --single-branch
|
||||
git -C $repo remote set-url nushell --push git@github.com:nushell/nushell.github.io.git
|
||||
|
||||
log info "creating release branch"
|
||||
git -C $repo checkout -b $branch
|
||||
|
||||
log info "writing release note"
|
||||
$release_note | save --force $blog_path
|
||||
|
||||
log info "committing release note"
|
||||
git -C $repo add $blog_path
|
||||
git -C $repo commit -m $"($title)\n\n($body)"
|
||||
|
||||
log info "pushing release note to nushell"
|
||||
git -C $repo push nushell $branch
|
||||
|
||||
let out = (do -i { gh auth status } | complete)
|
||||
if $out.exit_code != 0 {
|
||||
clean $repo
|
||||
|
||||
let pr_url = $"https://github.com/nushell/nushell.github.io/compare/($branch)?expand=1"
|
||||
error make --unspanned {
|
||||
msg: ([
|
||||
$out.stderr
|
||||
$"please open the PR manually from a browser (ansi blue_underline)($pr_url)(ansi reset)"
|
||||
] | str join "\n")
|
||||
}
|
||||
}
|
||||
|
||||
log info "opening pull request"
|
||||
open-pr $repo nushell/nushell.github.io {
|
||||
branch: $"nushell:($branch)"
|
||||
title: $title
|
||||
body: $body
|
||||
}
|
||||
|
||||
clean $repo
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
def main [
|
||||
date?: datetime # the date of the last release (default to 4 weeks ago, excluded)
|
||||
] {
|
||||
let list_merged_prs_script = (
|
||||
$env.CURRENT_FILE | path dirname | path join "list-merged-prs"
|
||||
)
|
||||
|
||||
let changelogs = [
|
||||
[title repo];
|
||||
|
||||
[Nushell nushell/nushell]
|
||||
[Extension nushell/vscode-nushell-lang]
|
||||
[Documentation nushell/nushell.github.io]
|
||||
[Nu_Scripts nushell/nu_scripts]
|
||||
[Reedline nushell/reedline]
|
||||
]
|
||||
|
||||
$changelogs | each {|changelog|
|
||||
[
|
||||
$"## ($changelog.title)"
|
||||
(^$list_merged_prs_script $changelog.repo --pretty $date)
|
||||
] | str join "\n"
|
||||
}
|
||||
| str join "\n\n"
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
|
||||
# Prepare the GitHub release text
|
||||
def main [
|
||||
versionname: string # The version we release now
|
||||
bloglink: string # The link to the blogpost
|
||||
date?: datetime # the date of the last release (default to 3 weeks ago, excluded)
|
||||
] {
|
||||
let date = (
|
||||
if $date == null { (date now) - 4wk + 1day } else { $date }
|
||||
| format date "%Y-%m-%d"
|
||||
)
|
||||
|
||||
let repo = "nushell/nushell"
|
||||
let query = $"merged:>($date)"
|
||||
|
||||
let prs = (
|
||||
gh --repo $repo pr list
|
||||
--state merged
|
||||
--limit (inf | into int)
|
||||
--json author,title,number,mergedAt,url
|
||||
--search $query
|
||||
| from json
|
||||
| sort-by mergedAt --reverse
|
||||
| update author { get login }
|
||||
)
|
||||
|
||||
let authors = $prs.author | uniq | sort -i
|
||||
|
||||
let author_string = ($authors | each {|name| $"@($name)"} | str join ", " )
|
||||
|
||||
let release_text = [
|
||||
$"This is the ($versionname) release of Nushell. You can learn more about this release here: ($bloglink)",
|
||||
"",
|
||||
"For convenience, we are providing full builds for Windows, Linux, and macOS. Be sure you have the requirements to enable all capabilities: https://www.nushell.sh/book/installation.html#dependencies",
|
||||
"",
|
||||
$"This release was made possible by PR contributions from ($author_string)"
|
||||
]
|
||||
|
||||
$release_text | str join "\n"
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env nu
|
||||
use std log
|
||||
|
||||
def md-link [
|
||||
text: string
|
||||
link: string
|
||||
] {
|
||||
$"[($text)]\(($link)\)"
|
||||
}
|
||||
|
||||
# list all merged PRs since last release
|
||||
export def main [
|
||||
repo: string # the name of the repo, e.g. `nushell/nushell`
|
||||
--date: datetime # the date of the last release (default to 4 weeks ago, excluded, if no milestone is set)
|
||||
--milestone: string # search PRs by milestone
|
||||
--label: string # the label to filter the PRs by, e.g. `good-first-issue`
|
||||
--pretty # pretty-print for the MarkDown release not
|
||||
--no-author # do not group the contributions by author
|
||||
--table # make an Antoine table
|
||||
] {
|
||||
mut query_parts = []
|
||||
|
||||
let date = if $date == null and $milestone == null {
|
||||
(date now) - 4wk
|
||||
} else {
|
||||
$date
|
||||
}
|
||||
|
||||
if $date != null {
|
||||
let date = $date | format date "%Y-%m-%d"
|
||||
let since = (date now | format date %F | into datetime) - ($date | into datetime)
|
||||
log info $"listing PRs in ($repo) since ($date) \(($since) ago\)"
|
||||
$query_parts ++= [ $"merged:>($date)" ]
|
||||
}
|
||||
|
||||
if $milestone != null {
|
||||
log info $"listing PRs in milestone ($milestone)"
|
||||
$query_parts ++= [ $'milestone:"($milestone)"' ]
|
||||
}
|
||||
|
||||
if $label != null {
|
||||
log info $"listing PRs with label ($label)"
|
||||
$query_parts ++= [ $'label:($label)' ]
|
||||
}
|
||||
|
||||
let query = $query_parts | str join ' '
|
||||
|
||||
let prs = (
|
||||
gh --repo $repo pr list
|
||||
--state merged
|
||||
--limit (inf | into int)
|
||||
--json author,title,number,mergedAt,url
|
||||
--search $query
|
||||
| from json
|
||||
| sort-by mergedAt --reverse
|
||||
| update author { get login }
|
||||
)
|
||||
|
||||
if $table {
|
||||
return (
|
||||
$prs
|
||||
| update author {md-link $"@($in)" $"https://github.com/($in)"}
|
||||
| insert PR {|pr| md-link $"#($pr.number)" $pr.url}
|
||||
| select author title PR
|
||||
| to md
|
||||
)
|
||||
}
|
||||
|
||||
if $pretty {
|
||||
if $no_author {
|
||||
return (
|
||||
$prs | each {|pr|
|
||||
let link = (md-link $"#($pr.number)" $pr.url)
|
||||
$"- ($link) ($pr.title)"
|
||||
}
|
||||
| str join "\n"
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
$prs
|
||||
| group-by author
|
||||
| transpose author prs
|
||||
| each {|line|
|
||||
let author = (md-link $line.author $"https://github.com/($line.author)")
|
||||
|
||||
$"- ($author) created" | append (
|
||||
$line.prs | each {|pr|
|
||||
let link = (md-link $pr.title $pr.url)
|
||||
$" - ($link)"
|
||||
}
|
||||
)
|
||||
| str join "\n"
|
||||
}
|
||||
| to text
|
||||
)
|
||||
}
|
||||
|
||||
$prs
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
title: Nushell {{VERSION}}
|
||||
author: The Nu Authors
|
||||
author_site: https://twitter.com/nu_shell
|
||||
author_image: https://www.nushell.sh/blog/images/nu_logo.png
|
||||
excerpt: Today, we're releasing version {{VERSION}} of Nu. This release adds...
|
||||
---
|
||||
<!-- TODO: complete the excerpt above -->
|
||||
|
||||
# Nushell {{VERSION}}
|
||||
|
||||
Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your command line. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful command line pipelines.
|
||||
|
||||
<!-- TODO: write this excerpt -->
|
||||
Today, we're releasing version {{VERSION}} of Nu. This release adds...
|
||||
|
||||
# Where to get it
|
||||
|
||||
Nu {{VERSION}} is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/{{VERSION}}) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`.
|
||||
|
||||
As part of this release, we also publish a set of optional plugins you can install and use with Nu. To install, use `cargo install nu_plugin_<plugin name>`.
|
||||
|
||||
# Table of contents
|
||||
- [_Highlights and themes of this release_](#highlights-and-themes-of-this-release-toc)
|
||||
- [_Changes_](#changes-toc)
|
||||
- [_Additions_](#additions-toc)
|
||||
- [_Breaking changes_](#breaking-changes-toc)
|
||||
- [_Deprecations_](#deprecations-toc)
|
||||
- [_Removals_](#removals-toc)
|
||||
- [_Bug fixes and other changes_](#bug-fixes-and-other-changes-toc)
|
||||
- [_Notes for plugin developers_](#notes-for-plugin-developers-toc)
|
||||
- [_Hall of fame_](#hall-of-fame-toc)
|
||||
- [_Full changelog_](#full-changelog-toc)
|
||||
<!-- TODO: please add links to the other sections here
|
||||
|
||||
the following command should help pre-generate a great deal of the table of content.
|
||||
be careful with the format and false-positives :wink:
|
||||
```nushell
|
||||
rg '^#+ ' blog/...
|
||||
| lines
|
||||
| each {
|
||||
str replace '# ' '- '
|
||||
| str replace --all '#' ' '
|
||||
| str replace --regex '- (.*)' '- [_$1_](#$1-toc)'
|
||||
}
|
||||
| to text
|
||||
```
|
||||
-->
|
||||
|
||||
# Highlights and themes of this release [[toc](#table-of-content)]
|
||||
<!-- NOTE: if you wanna write a section about a breaking change, when it's a very important one,
|
||||
please add the following snippet to have a "warning" banner :)
|
||||
> see [an example](https://www.nushell.sh/blog/2023-09-19-nushell_0_85_0.html#pythonesque-operators-removal)
|
||||
|
||||
```md
|
||||
::: warning Breaking change
|
||||
See a full overview of the [breaking changes](#breaking-changes)
|
||||
:::
|
||||
```
|
||||
-->
|
||||
<!-- NOTE: see https://vuepress.github.io/reference/default-theme/markdown.html#custom-containers
|
||||
for the list of available *containers*
|
||||
-->
|
||||
|
||||
# Changes [[toc](#table-of-content)]
|
||||
|
||||
## Additions [[toc](#table-of-content)]
|
||||
|
||||
## Breaking changes [[toc](#table-of-content)]
|
||||
|
||||
## Deprecations [[toc](#table-of-content)]
|
||||
|
||||
## Removals [[toc](#table-of-content)]
|
||||
|
||||
## Bug fixes and other changes [[toc](#table-of-content)]
|
||||
|
||||
<!-- NOTE: to start investigating the contributions of last release, i like to list them all in a raw table.
|
||||
to achieve this, one can use the [`list-merged-prs` script from `nu_scripts`](https://github.com/nushell/nu_scripts/blob/main/make_release/release-note/list-merged-prs)
|
||||
as follows:
|
||||
|
||||
```nushell
|
||||
use ./make_release/release-note/list-merged-prs
|
||||
use std clip
|
||||
|
||||
let last_release_date = ^gh api /repos/nushell/nushell/releases
|
||||
| from json
|
||||
| into datetime published_at
|
||||
| get published_at
|
||||
| sort
|
||||
| last
|
||||
|
||||
let prs = list-merged-prs nushell/nushell $last_release_date
|
||||
| sort-by mergedAt
|
||||
| update url {|it| $"[#($it.number)]\(($it.url)\)" }
|
||||
| update author { $"[@($in)]\(https://github.com/($in)\)" }
|
||||
| select author title url
|
||||
| rename -c {url: pr}
|
||||
| to md --pretty
|
||||
|
||||
$prs | to md --pretty | clip
|
||||
```
|
||||
-->
|
||||
|
||||
# Notes for plugin developers [[toc](#table-of-content)]
|
||||
|
||||
# Hall of fame [[toc](#table-of-content)]
|
||||
|
||||
Thanks to all the contributors below for helping us solve issues and improve documentation :pray:
|
||||
|
||||
| author | title | url |
|
||||
| ------------------------------------ | ----------- | ------------------------------------------------------- |
|
||||
| [@author](https://github.com/author) | ... | [#12345](https://github.com/nushell/nushell/pull/12345) |
|
||||
|
||||
# Full changelog [[toc](#table-of-content)]
|
||||
<!-- TODO:
|
||||
paste the output of
|
||||
```nu
|
||||
./make_release/release-note/get-full-changelog
|
||||
```
|
||||
here
|
||||
-->
|
||||
Reference in New Issue
Block a user