This repository has been archived by the owner on May 27, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from getantibody/cobra
Replaced cli with cobra
- Loading branch information
Showing
24 changed files
with
226 additions
and
181 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,7 @@ | ||
|
||
[[dependencies]] | ||
name = "github.com/getantibody/folder" | ||
version = "v1.0.0" | ||
|
||
[[dependencies]] | ||
name = "github.com/stretchr/testify" | ||
version = "^1.1.4" | ||
|
||
[[dependencies]] | ||
name = "github.com/urfave/cli" | ||
version = "^1.19.1" | ||
|
||
[[dependencies]] | ||
branch = "master" | ||
name = "golang.org/x/crypto" | ||
|
||
[[dependencies]] | ||
branch = "master" | ||
name = "golang.org/x/sync" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package antibody | ||
package antibodylib | ||
|
||
import ( | ||
"bufio" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package antibodylib | ||
|
||
// Version is antibody's version | ||
var Version = "dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package antibody | ||
package antibodylib | ||
|
||
import ( | ||
"sort" | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cmd | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"io" | ||
"os" | ||
"strings" | ||
|
||
"github.com/getantibody/antibody/antibodylib" | ||
"github.com/spf13/cobra" | ||
"golang.org/x/crypto/ssh/terminal" | ||
) | ||
|
||
var bundleCmd = &cobra.Command{ | ||
Use: "bundle", | ||
Aliases: []string{"b"}, | ||
Short: "downloads a bundle and prints its source line", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
var input io.Reader | ||
if !terminal.IsTerminal(int(os.Stdin.Fd())) && len(args) == 0 { | ||
input = os.Stdin | ||
} else { | ||
input = bytes.NewBufferString(strings.Join(args, " ")) | ||
} | ||
sh, err := antibodylib.New(antibodylib.Home(), input).Bundle() | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println(sh) | ||
return nil | ||
}, | ||
} | ||
|
||
func init() { | ||
RootCmd.AddCommand(bundleCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/getantibody/antibody/antibodylib" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var homeCmd = &cobra.Command{ | ||
Use: "home", | ||
Short: "shows the current antibody home folder", | ||
Aliases: []string{"prefix", "p"}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println(antibodylib.Home()) | ||
}, | ||
} | ||
|
||
func init() { | ||
RootCmd.AddCommand(homeCmd) | ||
} |
Oops, something went wrong.