cmds

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: GPL-3.0 Imports: 47 Imported by: 1

Documentation

Overview

Package cmds provides CLI tools for running various actions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksumCommand added in v1.2.1

type ChecksumCommand struct {
	FeedPath   string
	RawDirSHA1 bool
	RawZipSHA1 bool
}

ChecksumCommand calculates the SHA1 checksum of a static GTFS feed. The SHA1 checksum uniquely identifies a feed version and is used by Transitland to detect when new feed versions are available. This command calculates the SHA1 using the DirSHA1 method, which processes the contents of the feed archive, not the zip archive as a whole

func (*ChecksumCommand) AddFlags added in v1.2.1

func (cmd *ChecksumCommand) AddFlags(fl *pflag.FlagSet)

func (*ChecksumCommand) HelpArgs added in v1.2.1

func (cmd *ChecksumCommand) HelpArgs() string

func (*ChecksumCommand) HelpDesc added in v1.2.1

func (cmd *ChecksumCommand) HelpDesc() (string, string)

func (*ChecksumCommand) Parse added in v1.2.1

func (cmd *ChecksumCommand) Parse(args []string) error

Parse command line options.

func (*ChecksumCommand) Run added in v1.2.1

func (cmd *ChecksumCommand) Run(ctx context.Context) error

Run this command.

type CopyCommand

type CopyCommand struct {
	copier.Options
	// contains filtered or unexported fields
}

CopyCommand

func (*CopyCommand) AddFlags

func (cmd *CopyCommand) AddFlags(fl *pflag.FlagSet)

func (*CopyCommand) HelpArgs

func (cmd *CopyCommand) HelpArgs() string

func (*CopyCommand) HelpDesc

func (cmd *CopyCommand) HelpDesc() (string, string)

func (*CopyCommand) HelpExample

func (cmd *CopyCommand) HelpExample() string

func (*CopyCommand) Parse

func (cmd *CopyCommand) Parse(args []string) error

func (*CopyCommand) Run

func (cmd *CopyCommand) Run(ctx context.Context) error

type DBMigrateCommand added in v1.2.0

type DBMigrateCommand struct {
	DBURL      string
	Subcommand string
	Adapter    tldb.Adapter
}

func (*DBMigrateCommand) AddFlags added in v1.2.0

func (cmd *DBMigrateCommand) AddFlags(fl *pflag.FlagSet)

func (*DBMigrateCommand) HelpArgs added in v1.2.0

func (cmd *DBMigrateCommand) HelpArgs() string

func (*DBMigrateCommand) HelpDesc added in v1.2.0

func (cmd *DBMigrateCommand) HelpDesc() (string, string)

func (*DBMigrateCommand) Parse added in v1.2.0

func (cmd *DBMigrateCommand) Parse(args []string) error

Parse command line options.

func (*DBMigrateCommand) Run added in v1.2.0

func (cmd *DBMigrateCommand) Run(ctx context.Context) error

Run this command.

type DeleteCommand

type DeleteCommand struct {
	ExtraTables []string
	DryRun      bool
	FVID        int
	DBURL       string
	Adapter     tldb.Adapter // allow for mocks
}

func (*DeleteCommand) AddFlags

func (cmd *DeleteCommand) AddFlags(fl *pflag.FlagSet)

func (*DeleteCommand) HelpArgs

func (cmd *DeleteCommand) HelpArgs() string

func (*DeleteCommand) HelpDesc

func (cmd *DeleteCommand) HelpDesc() (string, string)

func (*DeleteCommand) Parse

func (cmd *DeleteCommand) Parse(args []string) error

Parse command line flags

func (*DeleteCommand) Run

func (cmd *DeleteCommand) Run(ctx context.Context) error

Run this command

type ExtractCommand

type ExtractCommand struct {
	// Default options
	copier.Options

	// extract specific arguments
	Prefix string
	// contains filtered or unexported fields
}

ExtractCommand

func (*ExtractCommand) AddFlags

func (cmd *ExtractCommand) AddFlags(fl *pflag.FlagSet)

func (*ExtractCommand) HelpArgs

func (cmd *ExtractCommand) HelpArgs() string

func (*ExtractCommand) HelpDesc

func (cmd *ExtractCommand) HelpDesc() (string, string)

func (*ExtractCommand) HelpExample

func (cmd *ExtractCommand) HelpExample() string

func (*ExtractCommand) Parse

func (cmd *ExtractCommand) Parse(args []string) error

func (*ExtractCommand) Run

func (cmd *ExtractCommand) Run(ctx context.Context) error

type FetchCommand

type FetchCommand struct {
	Options     fetch.StaticFetchOptions
	SecretsFile string
	CreateFeed  bool
	Workers     int
	Fail        bool
	Limit       int
	DBURL       string
	DryRun      bool
	FeedIDs     []string
	Results     []FetchCommandResult
	Adapter     tldb.Adapter // allow for mocks
	// contains filtered or unexported fields
}

FetchCommand fetches feeds defined a DMFR database.

func (*FetchCommand) AddFlags

func (cmd *FetchCommand) AddFlags(fl *pflag.FlagSet)

func (*FetchCommand) HelpArgs

func (cmd *FetchCommand) HelpArgs() string

func (*FetchCommand) HelpDesc

func (cmd *FetchCommand) HelpDesc() (string, string)

func (*FetchCommand) Parse

func (cmd *FetchCommand) Parse(args []string) error

func (*FetchCommand) Run

func (cmd *FetchCommand) Run(ctx context.Context) error

Run executes this command.

type FetchCommandResult

type FetchCommandResult struct {
	Result                     fetch.Result
	FeedVersion                *dmfr.FeedVersion
	FeedVersionValidatorResult *validator.Result
	FatalError                 error
}

type FormatCommand

type FormatCommand struct {
	Filename string
	Save     bool
}

FormatCommand formats a DMFR file.

func (*FormatCommand) AddFlags

func (cmd *FormatCommand) AddFlags(fl *pflag.FlagSet)

func (*FormatCommand) HelpArgs

func (cmd *FormatCommand) HelpArgs() string

func (*FormatCommand) HelpDesc

func (cmd *FormatCommand) HelpDesc() (string, string)

func (*FormatCommand) Parse

func (cmd *FormatCommand) Parse(args []string) error

Parse command line options.

func (*FormatCommand) Run

func (cmd *FormatCommand) Run(ctx context.Context) error

Run this command.

type ImportCommand

type ImportCommand struct {
	Options      importer.Options
	Workers      int
	Limit        int
	Fail         bool
	DBURL        string
	CoverDate    string
	FetchedSince string
	Latest       bool
	DryRun       bool
	FeedIDs      []string
	FVIDs        []string
	FVSHA1       []string
	Results      []ImportCommandResult
	Adapter      tldb.Adapter // allow for mocks
	// contains filtered or unexported fields
}

ImportCommand imports FeedVersions into a database.

func (*ImportCommand) AddFlags

func (cmd *ImportCommand) AddFlags(fl *pflag.FlagSet)

func (*ImportCommand) HelpArgs

func (cmd *ImportCommand) HelpArgs() string

func (*ImportCommand) HelpDesc

func (cmd *ImportCommand) HelpDesc() (string, string)

func (*ImportCommand) Parse

func (cmd *ImportCommand) Parse(args []string) error

Parse command line flags

func (*ImportCommand) Run

func (cmd *ImportCommand) Run(ctx context.Context) error

Run this command

type ImportCommandResult

type ImportCommandResult struct {
	Result     importer.Result
	FatalError error
}

type LintCommand

type LintCommand struct {
	Filenames []string
}

LintCommand lints a DMFR file.

func (*LintCommand) AddFlags

func (cmd *LintCommand) AddFlags(fl *pflag.FlagSet)

func (*LintCommand) HelpArgs

func (cmd *LintCommand) HelpArgs() string

func (*LintCommand) HelpDesc

func (cmd *LintCommand) HelpDesc() (string, string)

func (*LintCommand) Parse

func (cmd *LintCommand) Parse(args []string) error

Parse command line options.

func (*LintCommand) Run

func (cmd *LintCommand) Run(ctx context.Context) error

Run this command.

type MergeCommand

type MergeCommand struct {
	Options copier.Options
	// contains filtered or unexported fields
}

MergeCommand

func (*MergeCommand) AddFlags

func (cmd *MergeCommand) AddFlags(fl *pflag.FlagSet)

func (*MergeCommand) HelpArgs

func (cmd *MergeCommand) HelpArgs() string

func (*MergeCommand) HelpDesc

func (cmd *MergeCommand) HelpDesc() (string, string)

func (*MergeCommand) Parse

func (cmd *MergeCommand) Parse(args []string) error

func (*MergeCommand) Run

func (cmd *MergeCommand) Run(ctx context.Context) error

type RTConvertCommand added in v1.0.0

type RTConvertCommand struct {
	InputFile  string
	OutputFile string
	Format     string
}

RTConvertCommand

func (*RTConvertCommand) AddFlags added in v1.0.0

func (cmd *RTConvertCommand) AddFlags(fl *pflag.FlagSet)

func (*RTConvertCommand) HelpArgs added in v1.0.0

func (cmd *RTConvertCommand) HelpArgs() string

func (*RTConvertCommand) HelpDesc added in v1.0.0

func (cmd *RTConvertCommand) HelpDesc() (string, string)

func (*RTConvertCommand) HelpExample added in v1.0.0

func (cmd *RTConvertCommand) HelpExample() string

func (*RTConvertCommand) Parse added in v1.0.0

func (cmd *RTConvertCommand) Parse(args []string) error

func (*RTConvertCommand) Run added in v1.0.0

func (cmd *RTConvertCommand) Run(ctx context.Context) error

type RebuildStatsCommand

type RebuildStatsCommand struct {
	Options RebuildStatsOptions
	Workers int
	DBURL   string
	FeedIDs []string
	FVIDs   []string
	FVSHA1  []string
	Adapter tldb.Adapter // allow for mocks
	// contains filtered or unexported fields
}

RebuildStatsCommand rebuilds feed version statistics

func (*RebuildStatsCommand) AddFlags

func (cmd *RebuildStatsCommand) AddFlags(fl *pflag.FlagSet)

func (*RebuildStatsCommand) HelpArgs

func (cmd *RebuildStatsCommand) HelpArgs() string

func (*RebuildStatsCommand) HelpDesc

func (cmd *RebuildStatsCommand) HelpDesc() (string, string)

func (*RebuildStatsCommand) Parse

func (cmd *RebuildStatsCommand) Parse(args []string) error

Parse command line flags

func (*RebuildStatsCommand) Run

func (cmd *RebuildStatsCommand) Run(ctx context.Context) error

Run this command

type RebuildStatsOptions

type RebuildStatsOptions struct {
	FeedVersionID           int
	Storage                 string
	ValidationReportStorage string
	SaveValidationReport    bool
}

type RebuildStatsResult

type RebuildStatsResult struct {
	Error error
}

type SyncCommand

type SyncCommand struct {
	DBURL   string
	Adapter tldb.Adapter
	sync.Options
}

SyncCommand syncs a DMFR to a database.

func (*SyncCommand) AddFlags

func (cmd *SyncCommand) AddFlags(fl *pflag.FlagSet)

func (*SyncCommand) HelpArgs

func (cmd *SyncCommand) HelpArgs() string

func (*SyncCommand) HelpDesc

func (cmd *SyncCommand) HelpDesc() (string, string)

func (*SyncCommand) Parse

func (cmd *SyncCommand) Parse(args []string) error

Parse command line options.

func (*SyncCommand) Run

func (cmd *SyncCommand) Run(ctx context.Context) error

Run this command.

type UnimportCommand

type UnimportCommand struct {
	ScheduleOnly bool
	ExtraTables  []string
	DryRun       bool
	FVIDs        []string
	FVSHA1       []string
	Extensions   []string
	FeedIDs      []string
	DBURL        string
	Workers      int
	Adapter      tldb.Adapter // allow for mocks
	// contains filtered or unexported fields
}

UnimportCommand imports FeedVersions into a database.

func (*UnimportCommand) AddFlags

func (cmd *UnimportCommand) AddFlags(fl *pflag.FlagSet)

func (*UnimportCommand) HelpArgs

func (cmd *UnimportCommand) HelpArgs() string

func (*UnimportCommand) HelpDesc

func (cmd *UnimportCommand) HelpDesc() (string, string)

func (*UnimportCommand) Parse

func (cmd *UnimportCommand) Parse(args []string) error

Parse command line flags

func (*UnimportCommand) Run

func (cmd *UnimportCommand) Run(ctx context.Context) error

Run this command

type ValidatorCommand

type ValidatorCommand struct {
	Options validator.Options

	OutputFile string
	DBURL      string
	FVID       int

	SaveValidationReport    bool
	ValidationReportStorage string
	// contains filtered or unexported fields
}

ValidatorCommand

func (*ValidatorCommand) AddFlags

func (cmd *ValidatorCommand) AddFlags(fl *pflag.FlagSet)

func (*ValidatorCommand) HelpArgs

func (cmd *ValidatorCommand) HelpArgs() string

func (*ValidatorCommand) HelpDesc

func (cmd *ValidatorCommand) HelpDesc() (string, string)

func (*ValidatorCommand) HelpExample

func (cmd *ValidatorCommand) HelpExample() string

func (*ValidatorCommand) Parse

func (cmd *ValidatorCommand) Parse(args []string) error

func (*ValidatorCommand) Run

func (cmd *ValidatorCommand) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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