Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cmd/awscli.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package cmd

import (
"os"

log "github.com/Sirupsen/logrus"
"github.com/lmhd/lucli/creds"
"github.com/lmhd/lucli/lib"
"github.com/skybet/cali"
)

Expand All @@ -12,6 +15,10 @@ func init() {
command := cli.NewCommand("awscli [command]")
command.SetShort("AWS CLI / Shell")

// Allow this command to be run with awsshell too
// Dunno. Might made this a top tier command instead, so it shows in help.
command.SetAliases([]string{"awsshell"})

// TODO: long description
// Include AWS CLI/Shell
// Mention JQ is included
Expand All @@ -22,9 +29,9 @@ func init() {
task := command.Task("lucymhdavies/awscli:latest")

task.SetInitFunc(func(t *cali.Task, args []string) {
// TODO: detect if ran with awsshell alias?

if cli.FlagValues().GetBool("shell") {
// if awscli -s, or awsshell
if cli.FlagValues().GetBool("shell") || lib.StringSliceContains(os.Args, "awsshell") {
log.Debugf("Using AWS Shell")

// TODO: cali DockerClient.SetEntrypoint
Expand Down
12 changes: 12 additions & 0 deletions lib/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package lib

// Random useful stuff.

func StringSliceContains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}