cmd

package
Version: v0.0.0-...-6f0f38f Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NeoCitiesCMD = &cobra.Command{
		Use: "neocities",
	}

	UploadCMD = &cobra.Command{
		Use:  "upload file [-name string]",
		Args: cobra.ExactArgs(1),
		RunE: func(c *cobra.Command, args []string) error {
			if k != "" {
				s.Key, err = neocities.ReadFile(k)
				if err != nil {
					return fmt.Errorf("keyfile read returned error")
				}
			}

			if n == "" {
				n = filepath.Base(args[0])
			}

			err := s.UploadFile(args[0], n, nil)
			if err != nil {
				return err
			}

			return nil
		},
	}

	PushCMD = &cobra.Command{
		Use:  "push directory",
		Args: cobra.ExactArgs(1),
		RunE: func(c *cobra.Command, args []string) error {
			if k != "" {
				s.Key, err = neocities.ReadFile(k)
				if err != nil {
					return fmt.Errorf("keyfile read returned error")
				}
			}

			err := s.Push(args[0], nil)
			if err != nil {
				return err
			}

			return nil
		},
	}

	DeleteCMD = &cobra.Command{
		Use:  "delete files",
		Args: cobra.MinimumNArgs(1),
		RunE: func(c *cobra.Command, args []string) error {
			if k != "" {
				s.Key, err = neocities.ReadFile(k)
				if err != nil {
					return fmt.Errorf("keyfile read returned error")
				}
			}

			err := s.DeleteFiles(nil, args...)
			if err != nil {
				return nil
			}

			return nil
		},
	}
)

Functions

func AddNeoCitiesCMD

func AddNeoCitiesCMD(c *cobra.Command)

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL