lingrino/vaku

View on GitHub
cmd/folder.go

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
package cmd

import (
    "github.com/spf13/cobra"
)

const (
    folderUse     = "folder <cmd>"
    folderShort   = "Commands that act on Vault folders"
    folderExample = "vaku folder list secret/foo"
    folderLong    = `Commands that act on Vault folders

Commands under the folder subcommand act on Vault folders. Folders
are designated by paths that end in a '/' such as 'secret/foo/'. Vaku
can list, copy, move, search, etc.. on Vault folders.`
)

func (c *cli) newFolderCmd() *cobra.Command {
    cmd := &cobra.Command{
        Use:     folderUse,
        Short:   folderShort,
        Long:    folderLong,
        Example: folderExample,

        PersistentPreRunE: c.initVakuClient,
    }

    c.addPathFolderFlags(cmd)

    cmd.AddCommand(
        c.newFolderListCmd(),
        c.newFolderReadCmd(),
        c.newFolderWriteCmd(),
        c.newFolderDeleteCmd(),
        c.newFolderDeleteMetaCmd(),
        c.newFolderDestroyCmd(),
        c.newFolderSearchCmd(),
        c.newFolderCopyCmd(),
        c.newFolderMoveCmd(),
    )

    return cmd
}