Merge pull request #41 from FMotalleb/main

Fix: Handle .git extensions in repository URLs
This commit is contained in:
Darren Schroeder 2024-04-20 13:36:19 -04:00 committed by GitHub
commit 344529e8dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -133,7 +133,7 @@ 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 --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)
@ -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
}
@ -164,7 +167,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

View File

@ -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)