Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
596 additions
and
133 deletions.
There are no files selected for viewing
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,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// moveCmd represents the move command | ||
var moveCmd = &cobra.Command{ | ||
Use: "move", | ||
Short: "Move a command in nostromo manifest", | ||
Long: "Move a command in nostromo manifest", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
printUsage(cmd) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(moveCmd) | ||
} |
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,50 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/pokanop/nostromo/task" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rename string | ||
|
||
// movecmdCmd represents the movecmd command | ||
var movecmdCmd = &cobra.Command{ | ||
Use: "cmd [src.key.path] [dest.key.path] [options]", | ||
Short: "Move a command in nostromo manifest", | ||
Long: `Move a command in nostromo manifest for a given key path. | ||
A key path is a '.' delimited string, e.g., "key.path" which represents | ||
the alias which can be run as "key path" for the actual command provided. | ||
Manipulate the core nostromo manifest by moving command nodes. | ||
Using move, take a source key path and shift it to the destination | ||
key path with all subcommands in tow. | ||
If the destination key path does not exist, it will be created | ||
and the node will be moved there. Optionally provide a description | ||
with -d to the destination. | ||
To move a node to the root, do not provide a destination key path. | ||
To rename a node only, pass the -r flag with a name to use.`, | ||
Args: cobra.RangeArgs(1, 2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
var dest string | ||
if len(args) > 1 { | ||
dest = args[1] | ||
} | ||
if len(rename) == 0 { | ||
os.Exit(task.MoveCommand(args[0], dest, description)) | ||
} else { | ||
os.Exit(task.RenameCommand(args[0], rename, description)) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
moveCmd.AddCommand(movecmdCmd) | ||
|
||
movecmdCmd.Flags().StringVarP(&description, "description", "d", "", "Description of the destination to move command") | ||
movecmdCmd.Flags().StringVarP(&rename, "rename", "r", "", "Rename command instead of moving") | ||
} |
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,79 @@ | ||
name: docker | ||
source: https://github.com/pokanop/nostromo/blob/main/examples/docker.yaml | ||
path: /Users/gopher/.nostromo/ships/docker.yaml | ||
version: | ||
uuid: e1eea91e-6a6f-4838-b12b-7063732e4a56 | ||
semver: 0.9.2 | ||
gitcommit: 8a2350c0d5700cf2066977089f133af7daf7df60 | ||
builddate: "2022-02-02T23:29:30Z" | ||
config: | ||
verbose: false | ||
aliasesonly: false | ||
mode: 0 | ||
backupcount: 10 | ||
commands: | ||
docker: | ||
keypath: dock | ||
name: docker | ||
alias: dock | ||
aliasonly: false | ||
description: Alias for docker | ||
commands: | ||
clean: | ||
keypath: dock.clean | ||
name: ps -a -q |xargs docker rm | ||
alias: clean | ||
aliasonly: false | ||
description: Remove Docker containers using docker rm | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
rmi: | ||
keypath: dock.rmi | ||
name: rmi $(docker images -q) | ||
alias: rmi | ||
aliasonly: false | ||
description: Remove Docker images using docker rmi | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
stop: | ||
keypath: dock.stop | ||
name: ps -q |xargs docker stop | ||
alias: stop | ||
aliasonly: false | ||
description: Stop running Docker containers | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
vol: | ||
keypath: dock.vol | ||
name: volume rm $(docker volume ls -qf dangling=true) | ||
alias: vol | ||
aliasonly: false | ||
description: Remove dangling Docker volumes | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false |
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,144 @@ | ||
name: edit | ||
source: https://github.com/pokanop/nostromo/blob/main/examples/edit.yaml | ||
path: /Users/gopher/.nostromo/ships/edit.yaml | ||
version: | ||
uuid: 08f24962-402a-4323-a843-71c594b1c816 | ||
semver: 0.9.2 | ||
gitcommit: 8a2350c0d5700cf2066977089f133af7daf7df60 | ||
builddate: "2022-02-02T23:29:30Z" | ||
config: | ||
verbose: false | ||
aliasesonly: false | ||
mode: 0 | ||
backupcount: 10 | ||
commands: | ||
"": | ||
keypath: edit | ||
name: "" | ||
alias: edit | ||
aliasonly: false | ||
description: "" | ||
commands: | ||
bash: | ||
keypath: edit.bash | ||
name: vim ~/.bashrc | ||
alias: bash | ||
aliasonly: false | ||
description: Edit bashrc config file using vim | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
bash_profile: | ||
keypath: edit.bash_profile | ||
name: vim ~/.bash_profile | ||
alias: bash_profile | ||
aliasonly: false | ||
description: Edit bash_profile config file using vim | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
nostromo: | ||
keypath: edit.nostromo | ||
name: vim ~/.nostromo/manifest.yaml | ||
alias: nostromo | ||
aliasonly: false | ||
description: Edit nostromo manifest file using vim | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
p10k: | ||
keypath: edit.p10k | ||
name: vim ~/.p10k.zsh | ||
alias: p10k | ||
aliasonly: false | ||
description: Edit p10k config file in vim | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
profile: | ||
keypath: edit.profile | ||
name: vim ~/.profile | ||
alias: profile | ||
aliasonly: false | ||
description: Edit profile config file using vim | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
ssh: | ||
keypath: edit.ssh | ||
name: vim ~/.ssh/config | ||
alias: ssh | ||
aliasonly: false | ||
description: Edit ssh config file in vim | ||
commands: | ||
hosts: | ||
keypath: edit.ssh.hosts | ||
name: vim ~/.ssh/hosts | ||
alias: hosts | ||
aliasonly: false | ||
description: Edit ssh hosts file in vim | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 2 | ||
disabled: false | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
terminalizer: | ||
keypath: edit.terminalizer | ||
name: vim ~/.terminalizer/config.yml | ||
alias: terminalizer | ||
aliasonly: false | ||
description: Edit terminalizer config file | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
zsh: | ||
keypath: edit.zsh | ||
name: vim ~/.zshrc | ||
alias: zsh | ||
aliasonly: false | ||
description: Edit zsh config file using vim | ||
commands: {} | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false | ||
subs: {} | ||
code: | ||
language: "" | ||
snippet: "" | ||
mode: 0 | ||
disabled: false |
Oops, something went wrong.