Merge pull request #1 from pluto-language/show-modified-packages

Show modified packages
master
Zac Garby 5 years ago committed by GitHub
commit dcb006eb2f

@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"strings"
"github.com/fatih/color"
@ -55,26 +56,34 @@ func main() {
}
var (
installs = 0
removes = 0
updates = 0
installs []string
removes []string
updates []string
)
for _, op := range ops {
var err error
fmt.Printf(" - ")
switch op.Type {
case args.INSTALL:
fmt.Printf("installing %s", op.Package)
err = operators.Install(op.Package)
installs++
installs = append(installs, op.Package)
case args.REMOVE:
fmt.Printf("removing %s", op.Package)
err = operators.Remove(op.Package)
removes++
removes = append(removes, op.Package)
case args.UPDATE:
fmt.Printf("updating %s", op.Package)
err = operators.Update(op.Package)
updates++
updates = append(updates, op.Package)
}
fmt.Print(" ")
color.Green("done")
if err != nil {
fmt.Println(err)
os.Exit(1)
@ -94,7 +103,9 @@ func main() {
printStat(cyan, "UPDATED", updates)
}
func printStat(colour *color.Color, prefix string, count int) {
func printStat(colour *color.Color, prefix string, pkgs []string) {
count := len(pkgs)
if count > 0 {
colour.Printf("%10s ", prefix)
@ -104,6 +115,6 @@ func printStat(colour *color.Color, prefix string, count int) {
fmt.Printf("1 package")
}
fmt.Println()
fmt.Printf(" (%s)\n", strings.Join(pkgs, ", "))
}
}

@ -2,7 +2,6 @@ package operators
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@ -37,11 +36,8 @@ func Generate() error {
dir := filepath.Join(pwd, opts.title)
fmt.Println()
_, err = git.PlainClone(dir, false, &git.CloneOptions{
URL: "https://github.com/pluto-language/package-template",
Progress: os.Stdout,
URL: "https://github.com/pluto-language/package-template",
})
if err != nil {

@ -3,7 +3,6 @@ package operators
import (
"errors"
"fmt"
"os"
"path/filepath"
"gopkg.in/src-d/go-git.v4"
@ -31,8 +30,7 @@ func Install(pkg string) error {
}
_, err = git.PlainClone(filepath.Join(root, "libraries", pkg), false, &git.CloneOptions{
URL: repo,
Progress: os.Stdout,
URL: repo,
})
if err != nil {

@ -30,9 +30,6 @@ func getRoot() (string, error) {
}
func downloadDirectory() error {
fmt.Print("downloading packages directory... ")
defer fmt.Println("DONE")
var (
url = "https://raw.githubusercontent.com/pluto-language/packages/master/packages.json"
root, err = getRoot()
@ -65,9 +62,6 @@ func downloadDirectory() error {
}
func getPackages() (map[string]string, error) {
fmt.Print("parsing packages directory... ")
defer fmt.Println("DONE")
root, err := getRoot()
if err != nil {
return nil, err

Loading…
Cancel
Save