Skip to content

Commit

Permalink
fix (wont crash if branch is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
FMotalleb committed Dec 6, 2023
1 parent e8b4b70 commit ab5ff55
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions action.nu
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ export module plugin-list {
]: string -> record {
let git_repo = $in # 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 | url join)
return (http get --raw $toml_file_address | from toml)
try {
return (http get --raw $toml_file_address | from toml)
} catch {
return {}
}
}

# checks if given input is string or not
Expand All @@ -160,15 +164,26 @@ export module plugin-list {
repository: string
]: record -> record {
let toml: record = $in
return {
name: $"[($toml.package.name)]\(($repository)\)"
version: $toml.package.version
description: $toml.package.description?
plugin: ($toml.dependencies.nu-plugin
| get self or version)
protocol: ($toml.dependencies.nu-protocol
| get self or version)
if ([$toml.package?, $toml.dependencies?] | all {|i| $i != null} ) {
return {
name: $"[($toml.package.name)]\(($repository)\)"
version: $toml.package.version
description: $toml.package.description?
plugin: ($toml.dependencies.nu-plugin
| get self or version)
protocol: ($toml.dependencies.nu-protocol
| get self or version)
}
} else {
return {
name: $"issue in config file for \(($repository)\)"
version: "0.0"
description: ""
plugin: "0.0"
protocol: "0.0"
}
}

}

def "get icon" []: int -> string {
Expand Down

0 comments on commit ab5ff55

Please sign in to comment.