package cmd

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

func (c *Config) newEncryptCmd() *cobra.Command {
	encryptCmd := &cobra.Command{
		GroupID: groupIDEncryption,
		Use:     "encrypt [file...]",
		Short:   "Encrypt file or standard input",
		Long:    mustLongHelp("encrypt"),
		Example: example("encrypt"),
		RunE:    c.runEncryptCmd,
		Annotations: newAnnotations(
			persistentStateModeReadOnly,
		),
	}

	return encryptCmd
}

func (c *Config) runEncryptCmd(cmd *cobra.Command, args []string) error {
	return c.filterInput(args, c.encryption.Encrypt)
}
