Makes sure that the import name matches the module title, rather than the remote repo path

This commit is contained in:
sloum 2021-09-20 20:09:44 -07:00
parent 9db8c791c3
commit f6856766bf
2 changed files with 5 additions and 8 deletions

11
main.go
View File

@ -9,8 +9,8 @@ import (
)
const (
helptext string = `slp - slope package manager
banner string = "\033[32;1mslp - slope package manager\033[0m"
helptext string = `
slp docs [module] # open a module's readme in $PAGER
slp gen # creates new module dir/skeleton
slp help # print usage information
@ -20,14 +20,13 @@ slp list # lists all available packages
slp remove [module...] # removes module(s)
slp search [term...] # searches for modules
slp show [module...] # shows details module(s)
slp update [module...] # updates module(s)
`
slp update [module...] # updates module(s)`
)
func main() {
arg := os.Args
if len(arg) <= 1 {
fmt.Println(banner)
fmt.Println(helptext)
return
}
@ -42,10 +41,8 @@ func main() {
if len(arg) < 3 {
fmt.Println("The 'docs' command requires a module name as an argument: `slp docs [module]`")
}
fmt.Printf("Retrieving docs for %q", arg[2])
err := operators.ReadDocs(arg[2])
if err != nil {
fmt.Println(" \033[31m- done\033[0m")
fmt.Println(err)
os.Exit(1)
}

View File

@ -48,7 +48,7 @@ func Install(pkg string) error {
for k, _ := range depList {
fmt.Printf(" \033[2m├\033[0m staging %q\n", k)
p := packages[k]
repository, err := git.PlainClone(filepath.Join(stagingDir, k), false, &git.CloneOptions{
repository, err := git.PlainClone(filepath.Join(stagingDir, p.Title), false, &git.CloneOptions{
URL: p.Repository,
})