commands

package
v0.0.0-...-4ac1f56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Echo = cli.Command{
	Name:  "echo",
	Usage: "echoes an item value without copying",
	Action: func(c *cli.Context) error {
		if c.NArg() != 1 {
			fmt.Printf("%s Usage is simple, check it out:\n", utils.Cyan("Oi, mate!"))
			fmt.Printf("    goom echo %s\n", utils.Cyan("ITEM_NAME"))
			os.Exit(1)
			return nil
		}
		_, itemValue := storage.GroupOrItemNamed(c.Args().Get(0))
		if itemValue != "" {
			fmt.Println(itemValue)
			return nil
		}

		fmt.Printf("Item not found: %s\n", c.Args().Get(0))
		os.Exit(1)
		return nil
	},
}

Echo prints a given item without copying it to the clipboard. Helpful when pipeing to other commands

View Source
var ListAll = cli.Command{
	Name:  "all",
	Usage: "displays all items in all groups",
	Action: func(c *cli.Context) error {
		for g, i := range storage.ReadStore() {
			fmt.Println(utils.Underline(g))
			utils.PrintItems(i)
		}
		return nil
	},
}

ListAll lists all items in all groups

View Source
var RmGroup = cli.Command{
	Name:        "rm-group",
	Usage:       "removes a group and its childs",
	Description: "Removes all items held by the groups defined by the [arguments...] array and the groups themselves.",
	Action: func(c *cli.Context) error {
		data := storage.ReadStore()
		for _, n := range c.Args() {
			delete(data, n)
			fmt.Printf("%s %s is no more!\n", utils.Cyan("Goom!"), utils.Magenta(n))
		}
		storage.FlushStore(&data)
		return nil
	},
}

RmGroup removes a given set of groups and their children from the local store

View Source
var RmItem = cli.Command{
	Name:        "rm-item",
	Usage:       "deletes an item",
	Description: "Removes a specific item from a given group",
	Action: func(c *cli.Context) error {
		if c.NArg() != 2 {
			fmt.Printf("%s Usage is simple, check it out:\n", utils.Cyan("Oi, mate!"))
			fmt.Printf("    goom rm-item %s %s\n", utils.Magenta("GROUP"), utils.Cyan("ITEM_NAME"))
			os.Exit(1)
			return nil
		}
		group, name := c.Args().Get(0), c.Args().Get(1)
		storage.RemoveItem(group, name)
		fmt.Printf("%s Removed %s from %s\n", utils.Cyan("Goom!"), utils.Magenta(name), utils.Magenta(group))
		return nil
	},
}

RmItem removes a given item from the local store

Functions

func Overview

func Overview()

Overview prints a list of groups together with how many items they contain

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL