Skip to content

Commit

Permalink
support installing imgui
Browse files Browse the repository at this point in the history
  • Loading branch information
xq114 committed Oct 18, 2020
1 parent 2ad539e commit 9c0b440
Show file tree
Hide file tree
Showing 12 changed files with 409 additions and 138 deletions.
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module xpm

go 1.15

replace xpm_internal => ./xpm

require xpm_internal v0.0.0-00010101000000-000000000000
16 changes: 16 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
github.com/antchfx/xmlquery v1.3.3 h1:HYmadPG0uz8CySdL68rB4DCLKXz2PurCjS3mnkVF4CQ=
github.com/antchfx/xmlquery v1.3.3/go.mod h1:64w0Xesg2sTaawIdNqMB+7qaW/bSqkQm+ssPaCMWNnc=
github.com/antchfx/xpath v1.1.10 h1:cJ0pOvEdN/WvYXxvRrzQH9x5QWKpzHacYO8qzCcDYAg=
github.com/antchfx/xpath v1.1.10/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
5 changes: 0 additions & 5 deletions src/go.mod

This file was deleted.

119 changes: 0 additions & 119 deletions src/go.sum

This file was deleted.

14 changes: 0 additions & 14 deletions src/xpm.go

This file was deleted.

9 changes: 9 additions & 0 deletions test.go.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
xpm "xpm_internal"
)

func main() {
xpm.DownloadAndSave("http://raw.github.com/ocornut/imgui/v1.79/imconfig.h", ".", "lcs")
}
81 changes: 81 additions & 0 deletions xpm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package main

import (
"flag"
"fmt"
"os"
"strings"

xpm "xpm_internal"
)

var _Version string

var (
hflag bool
vflag bool
prefix string
)

func initGlobal() {
_Version = "0.0.1-alpha"
}

func initFlags() {
flag.BoolVar(&hflag, "help", false, "show this help information")
flag.BoolVar(&hflag, "h", false, "")
flag.BoolVar(&vflag, "version", false, "show version and exit")
flag.BoolVar(&vflag, "v", false, "")
flag.StringVar(&prefix, "prefix", ".", "set `prefix` path for installation")
flag.StringVar(&prefix, "p", ".", "")

flag.Parse()
}

func usage() {
fmt.Fprintf(os.Stderr, `XqPackageManager version: xpm/%s
Usage: xpm [-hv] [-p prefix] install <package_name>[@version] [config]
Options:
`, _Version)
flag.PrintDefaults()
}

func main() {
initGlobal()
initFlags()

if hflag {
usage()
return
}

if vflag {
fmt.Fprintf(os.Stdout, "xpm version %s\n", _Version)
return
}

args := flag.Args()
if len(args) < 2 {
usage()
return
}
switch args[0] {
case "install":
var vers string
vlist := strings.SplitN(args[1], "@", 2)
if len(vlist) == 2 {
vers = vlist[1]
} else {
vers = "latest"
}
config := args[2:]
err := xpm.Install(vlist[0], vers, config, prefix)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %s\n", err)
}
default:
usage()
return
}
}
5 changes: 5 additions & 0 deletions xpm/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/xq114/XqPackageManager/xpm

go 1.15

require github.com/antchfx/xmlquery v1.3.3
16 changes: 16 additions & 0 deletions xpm/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
github.com/antchfx/xmlquery v1.3.3 h1:HYmadPG0uz8CySdL68rB4DCLKXz2PurCjS3mnkVF4CQ=
github.com/antchfx/xmlquery v1.3.3/go.mod h1:64w0Xesg2sTaawIdNqMB+7qaW/bSqkQm+ssPaCMWNnc=
github.com/antchfx/xpath v1.1.10 h1:cJ0pOvEdN/WvYXxvRrzQH9x5QWKpzHacYO8qzCcDYAg=
github.com/antchfx/xpath v1.1.10/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Loading

0 comments on commit 9c0b440

Please sign in to comment.