Skip to content

Commit

Permalink
update update.nu
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-Sky committed May 15, 2024
1 parent 9e3278b commit c78a8d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,29 @@



## Usage
## Setup

First of all, you need to initialize the repository to equip with githooks helping you manage packages:

```bash
$ aurpublish setup
```

Then install nushell plugin [nu_plugin_query](https://crates.io/crates/nu_plugin_query) using nushell:

```nushell
$ plugin add <path/to/nu_plugin_query>
```



## Usage

When you make sure the upstream has upgraded, use `update.nu` to update the specified package:

```bash
# Check(-c) and update
$ ./update.nu <package-in-the-repository> -c
# Check and update
$ ./update.nu <package-in-the-repository>
```

> You can read the help of `update.nu`:
Expand Down
9 changes: 4 additions & 5 deletions update.nu
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/nu

plugin use query

# Check the new version of package and update it.
def main [
package: path, # Package going to update
Expand All @@ -20,14 +22,11 @@ def main [
nvchecker -c nvchecker.toml -l warning --failures -e $project
nvcmp -c nvchecker.toml

let old_ver = (open old_ver.json)
let new_ver = (open new_ver.json)
let old_ver = (open -r old_ver.json | query json $"data.($project).version")
let new_ver = (open -r new_ver.json | query json $"data.($project).version")

cd $package

let old_ver = ($old_ver | get $project)
let new_ver = ($new_ver | get $project)

if $old_ver != $new_ver {
open -r PKGBUILD
| str replace -r $"pkgver=($old_ver)" $"pkgver=($new_ver)"
Expand Down

0 comments on commit c78a8d3

Please sign in to comment.