cmds

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Package cmds used for commands modules

Index

Constants

View Source
const (
	SearchActionUsage = "allow to overwrite action in search command"
	IDLookupUsage     = "allow to overwrite id in search lookup"
	IDTypeUsage       = "allow to overwrite id_type in search lookup"
)

Usage strings in module

View Source
const (
	FoundOne = 1
	NotFound = 0
)

runtime consts

Variables

View Source
var (
	AppFs = afero.NewOsFs()
)

Command vars

View Source
var Avflags = map[string]bool{
	"a":          true,
	"c":          true,
	"calendars":  true,
	"collection": true,
	"days":       true,
	"ex":         true,
	"f":          true,
	"field":      true,
	"godoc":      true,
	"help":       true,
	"history":    true,
	"i":          true,
	"trakt_id":   true,
	"id_type":    true,
	"lists":      true,
	"o":          true,
	"people":     true,
	"q":          true,
	"remove":     true,
	"search":     true,
	"start_date": true,
	"t":          true,
	"u":          true,
	"users":      true,
	"v":          true,
	"version":    true,
	"watchlist":  true,
}

Avflags contains all available flags

View Source
var CalendarsCmd = &Command{
	Name:    "calendars",
	Usage:   "",
	Summary: "By default, the calendar will return all shows or movies for the specified time period and can be global or user specific.",
	Help:    `calendars command`,
}

CalendarsCmd process selected user calendars

View Source
var CollectionCmd = &Command{
	Name:    "collection",
	Usage:   "",
	Summary: "Get all collected items in a user's collection.",
	Help:    `collection command`,
}

CollectionCmd get all collected items in a user's collection.

Commands is list of all commands

View Source
var HelpCmd = &Command{
	Name:    "help",
	Usage:   "[<commands>]",
	Summary: "Help on the trakt-sync command and subcommands.",
}

HelpCmd shows help on the trakt-sync command and subcommands.

View Source
var HistoryCmd = &Command{
	Name:    "history",
	Usage:   "",
	Summary: "Returns movies and episodes that a user has watched, sorted by most recent.",
	Help:    `history command`,
}

HistoryCmd returns movies and episodes that a user has watched, sorted by most recent.

View Source
var ListsCmd = &Command{
	Name:    "lists",
	Usage:   "",
	Summary: "Returns data about lists: trending, popular, list, likes, like, items, comments.",
	Help:    `lists command`,
}

ListsCmd returns movies and episodes that a user has watched, sorted by most recent.

View Source
var PeopleCmd = &Command{
	Name:    "people",
	Usage:   "",
	Summary: "Returns all data for selected person.",
	Help:    `people command`,
}

PeopleCmd returns all data for selected person.

View Source
var SearchCmd = &Command{
	Name:    "search",
	Usage:   "",
	Summary: "Searches can use queries or ID lookups",
	Help:    `search command: Queries will search text fields like the title and overview. ID lookups are helpful if you have an external ID and want to get the Trakt ID and info. These methods can search for movies, shows, episodes, people, and str.`,
}

SearchCmd can use queries or ID lookups

View Source
var UsersCmd = &Command{
	Name:    "users",
	Usage:   "",
	Summary: "Returns all data for a users.",
	Help:    `users command`,
}

UsersCmd Returns all personal lists for a user.

View Source
var WatchlistCmd = &Command{
	Name:    "watchlist",
	Usage:   "",
	Summary: "Returns all items in a user's watchlist filtered by type.",
	Help:    `watchlist command`,
}

WatchlistCmd Returns all items in a user's watchlist filtered by type.

Functions

func HelpFunc

func HelpFunc(_ *Command, args ...string) error

HelpFunc shows help message for command

func ModulesRuntime

func ModulesRuntime(args []string, config *cfg.Config, client *internal.Client, fs afero.Fs)

ModulesRuntime core function for process commands

Types

type Command

type Command struct {
	Flag    flag.FlagSet
	Run     func(cmd *Command, args ...string) error
	Client  *internal.Client
	Config  *cfg.Config
	Options *str.Options
	Name    string
	Usage   string
	Summary string
	Help    string
	Abbrev  string
	// contains filtered or unexported fields
}

A Command represents a subcommand of trakt-sync.

func (*Command) BadArgs

func (c *Command) BadArgs(errFormat string, args ...any)

BadArgs shows error if command have invalid arguments

func (*Command) Errorf

func (c *Command) Errorf(errFormat string, args ...any)

Errorf prints out a formatted error with the right prefixes.

func (*Command) Exec

func (c *Command) Exec(fs afero.Fs, client *internal.Client, config *cfg.Config, args []string) error

Exec core command function

func (*Command) ExportListProcess

func (c *Command) ExportListProcess(
	data *str.ExportlistItem, options *str.Options,
	findDuplicates []any, exportJSON []str.ExportlistItemJSON,
) ([]any, []str.ExportlistItemJSON, error)

ExportListProcess process list items

func (*Command) Fatalf

func (c *Command) Fatalf(errFormat string, args ...any)

Fatalf is like Errorf except the stack unwinds up to the Exec call before exiting the application with status code 1.

func (*Command) IsImdbEpisode added in v1.0.2

func (*Command) IsImdbEpisode(options *str.Options, data *str.ExportlistItem) bool

IsImdbEpisode check episode imdb format

func (*Command) IsImdbMovie added in v1.0.2

func (*Command) IsImdbMovie(options *str.Options, data *str.ExportlistItem) bool

IsImdbMovie check movie imdb format

func (*Command) IsImdbShow added in v1.0.2

func (*Command) IsImdbShow(options *str.Options, data *str.ExportlistItem) bool

IsImdbShow check show imdb format

func (*Command) IsTmdbEpisode added in v1.0.2

func (*Command) IsTmdbEpisode(options *str.Options, data *str.ExportlistItem) bool

IsTmdbEpisode check episode tmdb format

func (*Command) IsTmdbMovie added in v1.0.2

func (*Command) IsTmdbMovie(options *str.Options, data *str.ExportlistItem) bool

IsTmdbMovie check movie tmdb format

func (*Command) IsTmdbShow added in v1.0.2

func (*Command) IsTmdbShow(options *str.Options, data *str.ExportlistItem) bool

IsTmdbShow check show tmdb format

func (*Command) IsTvdbEpisode added in v1.0.2

func (*Command) IsTvdbEpisode(options *str.Options, data *str.ExportlistItem) bool

IsTvdbEpisode check episode tvdb format

func (*Command) PrepareQueryString

func (*Command) PrepareQueryString(q string) *string

PrepareQueryString for remove or replace unwanted signs from query string

func (*Command) UpdateOptionsWithCommandFlags

func (c *Command) UpdateOptionsWithCommandFlags(options *str.Options) *str.Options

UpdateOptionsWithCommandFlags update options depends on command flags

func (*Command) ValidFlags

func (*Command) ValidFlags() bool

ValidFlags validate if flag is in our list

func (*Command) ValidType added in v1.3.0

func (*Command) ValidType(options *str.Options) error

ValidType check if type is valid

Jump to

Keyboard shortcuts

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