-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit for new empty branch * feat: implemented chore functionality * chore: add readme
- Loading branch information
1 parent
0267359
commit cb262aa
Showing
15 changed files
with
754 additions
and
413 deletions.
There are no files selected for viewing
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
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,73 @@ | ||
package cmd | ||
|
||
import ( | ||
"errors" | ||
"flag" | ||
"fmt" | ||
|
||
"github.com/SameerJadav/keyper/internal/core" | ||
) | ||
|
||
func Execute() error { | ||
var showHelp bool | ||
flag.BoolVar(&showHelp, "help", false, "show help") | ||
flag.BoolVar(&showHelp, "h", false, "show help (shorthand)") | ||
|
||
flag.Parse() | ||
|
||
usage := `Keyper is a CLI tool for effortlessly managing all your environment variables. | ||
Save environment variables locally and retrieve them with just one command. | ||
Keyper is simple, useful, and blazingly fast. | ||
Usage: | ||
keyper [flags] [command] | ||
Commands: | ||
set Set environment variables for a project | ||
get Retrieve environment variables for a project | ||
remove Remove specific environment variables from a project | ||
purge Remove all environment variables for a project or environment | ||
Flags: | ||
-h, --help Show help information for Keyper or its subcommands | ||
Examples: | ||
keyper --help | ||
keyper set myapp -e prod -f prod.env | ||
keyper get myapp -e prod -o .env | ||
keyper remove myapp --force -e prod API_KEY SECRET_TOKEN | ||
keyper purge myapp --force | ||
Use "keyper [command] --help" for more information about a command. | ||
Learn more about the Keyper at https://github.com/SameerJadav/keyper` | ||
|
||
args := flag.Args() | ||
|
||
if len(args) == 0 || showHelp { | ||
fmt.Println(usage) | ||
return nil | ||
} | ||
|
||
switch args[0] { | ||
case "set": | ||
if err := core.Set(); err != nil { | ||
return err | ||
} | ||
case "get": | ||
if err := core.Get(); err != nil { | ||
return err | ||
} | ||
case "purge": | ||
if err := core.Purge(); err != nil { | ||
return err | ||
} | ||
case "remove": | ||
if err := core.Remove(); err != nil { | ||
return err | ||
} | ||
default: | ||
return errors.New("unknown command. run \"keyper --help\" for usage") | ||
} | ||
|
||
return nil | ||
} |
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,3 +1,5 @@ | ||
module github.com/SameerJadav/keyper | ||
|
||
go 1.22.0 | ||
go 1.22.5 | ||
|
||
require github.com/SameerJadav/envparse v1.0.0 |
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 @@ | ||
github.com/SameerJadav/envparse v0.2.0 h1:2qgtdopNsA5iq9wB7oPEFJPWwrarrTmgwAWgw8BvJ50= | ||
github.com/SameerJadav/envparse v0.2.0/go.mod h1:gTaqzFU/gbU/aIL4vhXs2FZtmzTcprJHfqhoijkC6lg= | ||
github.com/SameerJadav/envparse v1.0.0 h1:BV1nzPdLh9Oe4duUauDszeNnwCtUTHYf0TJur4URrSM= | ||
github.com/SameerJadav/envparse v1.0.0/go.mod h1:gTaqzFU/gbU/aIL4vhXs2FZtmzTcprJHfqhoijkC6lg= |
Oops, something went wrong.