From 056602404022f2299452ce2f1095299852ffb271 Mon Sep 17 00:00:00 2001 From: Motalleb Fallahnezhad Date: Sat, 20 Apr 2024 20:29:36 +0330 Subject: [PATCH 1/3] fix: crash when (dependency) version was missing --- action.nu | 3 +++ 1 file changed, 3 insertions(+) diff --git a/action.nu b/action.nu index f6b76fb..a968fee 100644 --- a/action.nu +++ b/action.nu @@ -151,8 +151,11 @@ export module plugin-list { # TODO handle error def "get self or version" []: record -> string , string -> string { let input = $in + if ($input | is-str) { return $input; + } else if ($input.version? | is-empty) { + return "0.0.0" } else { return $input.version } From 0380a8c4f014f29fd9af85cde912fc15af5cd0da Mon Sep 17 00:00:00 2001 From: Motalleb Fallahnezhad Date: Sat, 20 Apr 2024 20:49:33 +0330 Subject: [PATCH 2/3] fix: remove `.git` at the end of url --- action.nu | 5 +++-- config.yaml | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/action.nu b/action.nu index a968fee..4a25f8a 100644 --- a/action.nu +++ b/action.nu @@ -133,7 +133,8 @@ export module plugin-list { def "get-toml" [ branch: string # branch name (e.g. main) ]: string -> record { - let git_repo = $in # github repository url (e.g. https://github.com/FMotalleb/nu_plugin_port_scan) + let git_repo = ($in | str replace ".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 | url join) try { return (http get --raw $toml_file_address | from toml) @@ -167,7 +168,7 @@ export module plugin-list { repository: string ]: record -> record { let toml: record = $in - if ([$toml.package?, $toml.dependencies?] | all {|i| $i != null} ) { + if ([$toml.package?, $toml.dependencies?] | all {|i| $i != null}) { return { name: $"[($toml.package.name)]\(($repository)\)" version: $toml.package.version diff --git a/config.yaml b/config.yaml index a04ab5e..7d8cc3b 100644 --- a/config.yaml +++ b/config.yaml @@ -232,14 +232,13 @@ plugins: - name: nu_plugin_dpkgtable language: rust repository: - url: https://github.com/pdenapo/nu_plugin_dpkgtable.git - branch: main + url: https://github.com/pdenapo/nu_plugin_dpkgtable + branch: main - name: nu_plugin_from_sse language: rust repository: url: https://github.com/cablehead/nu_plugin_from_sse branch: main - # Example # - name: nu_plugin_bin_reader # the plugins name (mandatory) # language: python # programming language (mandatory) From 302a065436bda21a37f2a6a3b81d5386696173de Mon Sep 17 00:00:00 2001 From: Motalleb Fallahnezhad Date: Sat, 20 Apr 2024 21:03:12 +0330 Subject: [PATCH 3/3] Fix: possible issue with `.git` in middle of the url? --- action.nu | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/action.nu b/action.nu index 4a25f8a..8b2daae 100644 --- a/action.nu +++ b/action.nu @@ -133,8 +133,7 @@ export module plugin-list { def "get-toml" [ branch: string # branch name (e.g. main) ]: string -> record { - let git_repo = ($in | str replace ".git" "") # github repository url (e.g. https://github.com/FMotalleb/nu_plugin_port_scan) - + 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 | url join) try { return (http get --raw $toml_file_address | from toml)