Skip to content

Commit

Permalink
action.nu: make suggested changes for PR #95
Browse files Browse the repository at this point in the history
  • Loading branch information
Taywee committed Dec 25, 2024
1 parent af88fc6 commit 6d2e787
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions action.nu
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,16 @@ export module plugin-list {
def "get-raw-toml-address" [
url: string, # github repository url (e.g. https://github.com/FMotalleb/nu_plugin_port_scan)
branch: string, # branch name (e.g. main)
software?: string,
software?: string
]: nothing -> record {
let url: record = ($url | url parse)

# Unspecified forge software is determined from the host.
let software = if $software == null {
let foo = match $url.host {
'github.com' => 'github',
'gitlab.com' => 'gitlab',
'codeberg.org' => 'forgejo',
}
$foo
} else {
$software
let software = match $url.host {
'github.com' => 'github',
'gitlab.com' => 'gitlab',
'codeberg.org' => 'forgejo',
_ => $software
}
use utils "str explode"
match $software {
Expand Down Expand Up @@ -150,8 +146,8 @@ export module plugin-list {

# download toml file from repository
def "get-toml" [
branch: string # branch name (e.g. main)
software?: string,
branch: string, # branch name (e.g. main)
software?: string
]: string -> record {
let git_repo = ($in | str replace --regex ".git$" "") # github repository url (e.g. https://github.com/FMotalleb/nu_plugin_port_scan)
let toml_file_address: string = (get-raw-toml-address $git_repo $branch $software | url join)
Expand Down Expand Up @@ -184,7 +180,7 @@ export module plugin-list {

# map `Cargo.toml` file to a plugin entry record
def "map-toml-to-entry" [
repository: string,
repository: string
]: record -> record {
let toml: record = $in
if ([$toml.package?, $toml.dependencies?] | all {|i| $i != null}) {
Expand Down

0 comments on commit 6d2e787

Please sign in to comment.