Documentation
¶
Overview ¶
Package cmds provides CLI tools for running various actions
Index ¶
- func NewDmfrCommand(pc string) *cobra.Command
- type ChecksumCommand
- type CopyCommand
- type DeleteCommand
- type DmfrCommand
- type DmfrFormatCommand
- type DmfrFromDirCommand
- type DmfrLintCommand
- type ExtractCommand
- func (cmd *ExtractCommand) AddFlags(fl *pflag.FlagSet)
- func (cmd *ExtractCommand) HelpArgs() string
- func (cmd *ExtractCommand) HelpDesc() (string, string)
- func (cmd *ExtractCommand) HelpExample() string
- func (cmd *ExtractCommand) Parse(args []string) error
- func (cmd *ExtractCommand) Run(ctx context.Context) error
- type FeedStateManagerCommand
- func (cmd *FeedStateManagerCommand) AddFlags(fl *pflag.FlagSet)
- func (cmd *FeedStateManagerCommand) HelpArgs() string
- func (cmd *FeedStateManagerCommand) HelpDesc() (string, string)
- func (cmd *FeedStateManagerCommand) Parse(args []string) error
- func (cmd *FeedStateManagerCommand) Run(ctx context.Context) error
- type FeedVersionArgs
- type FetchCommand
- type FetchCommandResult
- type FetchJob
- type FormatCommanddeprecated
- type ImportCommand
- type ImportCommandResult
- type ImportJob
- type LintCommand
- type MergeCommand
- type RTConvertCommand
- func (cmd *RTConvertCommand) AddFlags(fl *pflag.FlagSet)
- func (cmd *RTConvertCommand) HelpArgs() string
- func (cmd *RTConvertCommand) HelpDesc() (string, string)
- func (cmd *RTConvertCommand) HelpExample() string
- func (cmd *RTConvertCommand) Parse(args []string) error
- func (cmd *RTConvertCommand) Run(ctx context.Context) error
- type RebuildStatsCommand
- type RebuildStatsOptions
- type RebuildStatsResult
- type ServerCommand
- type StatsRemoveOnestopIDsCommand
- func (cmd *StatsRemoveOnestopIDsCommand) AddFlags(fl *pflag.FlagSet)
- func (cmd *StatsRemoveOnestopIDsCommand) HelpArgs() string
- func (cmd *StatsRemoveOnestopIDsCommand) HelpDesc() (string, string)
- func (cmd *StatsRemoveOnestopIDsCommand) Parse(args []string) error
- func (cmd *StatsRemoveOnestopIDsCommand) Run(ctx context.Context) error
- type SyncCommand
- type UnimportCommand
- type ValidatorCommand
- func (cmd *ValidatorCommand) AddFlags(fl *pflag.FlagSet)
- func (cmd *ValidatorCommand) HelpArgs() string
- func (cmd *ValidatorCommand) HelpDesc() (string, string)
- func (cmd *ValidatorCommand) HelpExample() string
- func (cmd *ValidatorCommand) Parse(args []string) error
- func (cmd *ValidatorCommand) Run(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDmfrCommand ¶ added in v1.3.1
Types ¶
type ChecksumCommand ¶ added in v1.2.1
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.
type CopyCommand ¶
CopyCommand copies a GTFS feed from a reader to a writer.
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
type DeleteCommand ¶
type DeleteCommand struct {
FVArgs FeedVersionArgs
ExtraTables []string
DryRun bool
DBURL string
Adapter tldb.Adapter // allow for mocks
}
DeleteCommand deletes feed versions.
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
type DmfrCommand ¶ added in v1.3.1
type DmfrCommand struct{}
DmfrCommand is the parent command for DMFR subcommands.
type DmfrFormatCommand ¶ added in v1.3.1
DmfrFormatCommand formats a DMFR file.
func (*DmfrFormatCommand) AddFlags ¶ added in v1.3.1
func (cmd *DmfrFormatCommand) AddFlags(fl *pflag.FlagSet)
func (*DmfrFormatCommand) HelpArgs ¶ added in v1.3.1
func (cmd *DmfrFormatCommand) HelpArgs() string
func (*DmfrFormatCommand) HelpDesc ¶ added in v1.3.1
func (cmd *DmfrFormatCommand) HelpDesc() (string, string)
func (*DmfrFormatCommand) Parse ¶ added in v1.3.1
func (cmd *DmfrFormatCommand) Parse(args []string) error
Parse command line options.
type DmfrFromDirCommand ¶ added in v1.3.1
DmfrFromDirCommand generates a DMFR file from a directory of GTFS files.
func (*DmfrFromDirCommand) AddFlags ¶ added in v1.3.1
func (cmd *DmfrFromDirCommand) AddFlags(fl *pflag.FlagSet)
func (*DmfrFromDirCommand) HelpArgs ¶ added in v1.3.1
func (cmd *DmfrFromDirCommand) HelpArgs() string
func (*DmfrFromDirCommand) HelpDesc ¶ added in v1.3.1
func (cmd *DmfrFromDirCommand) HelpDesc() (string, string)
func (*DmfrFromDirCommand) Parse ¶ added in v1.3.1
func (cmd *DmfrFromDirCommand) Parse(args []string) error
type DmfrLintCommand ¶ added in v1.3.1
type DmfrLintCommand struct {
Filenames []string
}
DmfrLintCommand lints a DMFR file.
func (*DmfrLintCommand) AddFlags ¶ added in v1.3.1
func (cmd *DmfrLintCommand) AddFlags(fl *pflag.FlagSet)
func (*DmfrLintCommand) HelpArgs ¶ added in v1.3.1
func (cmd *DmfrLintCommand) HelpArgs() string
func (*DmfrLintCommand) HelpDesc ¶ added in v1.3.1
func (cmd *DmfrLintCommand) HelpDesc() (string, string)
func (*DmfrLintCommand) Parse ¶ added in v1.3.1
func (cmd *DmfrLintCommand) Parse(args []string) error
Parse command line options.
type ExtractCommand ¶
type ExtractCommand struct {
// Default options
copier.Options
Prefix string
PrefixFilesInclude []string
PrefixFilesExclude []string
// contains filtered or unexported fields
}
ExtractCommand extracts a subset of a GTFS feed.
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
type FeedStateManagerCommand ¶ added in v1.3.0
type FeedStateManagerCommand struct {
DBURL string
ActivateFVIDs []string
DeactivateFVIDs []string
SetActiveFVIDs []string
SetActiveFVIDFile string
ForceMaterialize []string
ForceDematerialize []string
ForceRematerialize []string
SyncActive bool
DryRun bool
Adapter tldb.Adapter // allow for mocks
}
FeedStateManagerCommand manages feed state and materialized index tables
func (*FeedStateManagerCommand) AddFlags ¶ added in v1.3.0
func (cmd *FeedStateManagerCommand) AddFlags(fl *pflag.FlagSet)
func (*FeedStateManagerCommand) HelpArgs ¶ added in v1.3.0
func (cmd *FeedStateManagerCommand) HelpArgs() string
func (*FeedStateManagerCommand) HelpDesc ¶ added in v1.3.0
func (cmd *FeedStateManagerCommand) HelpDesc() (string, string)
func (*FeedStateManagerCommand) Parse ¶ added in v1.3.0
func (cmd *FeedStateManagerCommand) Parse(args []string) error
Parse command line flags
type FeedVersionArgs ¶ added in v1.4.0
type FeedVersionArgs struct {
FVIDs []string
FVSHA1 []string
// contains filtered or unexported fields
}
FeedVersionArgs is the shared CLI surface for commands that operate on feed versions. Feed version ids are the primary input, given as positional arguments (fvid1 fvid2 ...) or read from --fvid-file. --fvid and --fv-sha1(-file) are deprecated compatibility flags. There is no feed-level selection: resolve feeds to their versions first.
func (*FeedVersionArgs) AddFlags ¶ added in v1.4.0
func (a *FeedVersionArgs) AddFlags(fl *pflag.FlagSet)
func (*FeedVersionArgs) Empty ¶ added in v1.4.0
func (a *FeedVersionArgs) Empty() bool
Empty reports whether no feed version was selected.
func (*FeedVersionArgs) Parse ¶ added in v1.4.0
func (a *FeedVersionArgs) Parse(args []string) error
Parse reads positional feed version ids and the --fvid-file / --fv-sha1-file lists.
type FetchCommand ¶
type FetchCommand struct {
Options fetch.StaticFetchOptions
SecretsFile string
SecretEnv []string
CreateFeed bool
Workers int
Fail bool
Limit int
DBURL string
DryRun bool
FetchJobs []FetchJob // List of fetch operations
Results []FetchCommandResult
Adapter tldb.Adapter // allow for mocks
// contains filtered or unexported fields
}
FetchCommand fetches feeds defined in 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
type FetchCommandResult ¶
type FetchJob ¶ added in v1.3.1
type FetchJob struct {
FeedID string // Feed identifier (onestop_id)
FeedURL string // URL to fetch from (optional; if empty, looks up from database)
}
FetchJob specifies a single feed fetch operation. This allows programmatic specification of multiple fetches with different URLs.
type FormatCommand
deprecated
type FormatCommand = DmfrFormatCommand
Deprecated: Use DmfrFormatCommand instead.
type ImportCommand ¶
type ImportCommand struct {
FeedIDs []string // Filter by feed onestop_id
FVSHA1 []string // Filter by feed version SHA1
ImportJobs []ImportJob // Programmatic list of import operations
Options importer.Options
Workers int
Limit int
Fail bool
DBURL string
Latest bool
DryRun bool
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
type ImportCommandResult ¶
type ImportJob ¶ added in v1.3.1
type ImportJob struct {
FeedVersionID int
}
ImportJob specifies a single feed version import operation.
type LintCommand ¶
type LintCommand = DmfrLintCommand
Backwards compatibility aliases for renamed commands. Deprecated: Use DmfrLintCommand instead.
type MergeCommand ¶
MergeCommand merges multiple GTFS feeds into one.
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
type RTConvertCommand ¶ added in v1.0.0
RTConvertCommand converts a GTFS Realtime feed to JSON or GeoJSON.
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
type RebuildStatsCommand ¶
type RebuildStatsCommand struct {
FVArgs FeedVersionArgs
Options RebuildStatsOptions
Workers int
DryRun bool
DBURL string
Adapter tldb.Adapter // allow for mocks
}
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
type RebuildStatsOptions ¶
type RebuildStatsResult ¶
type RebuildStatsResult struct {
Error error
}
type ServerCommand ¶ added in v1.3.0
type ServerCommand struct {
Timeout int
LongQueryDuration int
Port string
RestPrefix string
LoadAdmins bool
ValidateLargeFiles bool
UseMaterialized bool
UseMaterializedDepartures bool
UseGeohashFilter bool
LoaderBatchSize int
LoaderStopTimeBatchSize int
SecretsFile string
Storage string
RTStorage string
DBURL string
RedisURL string
MaxRadius float64
// contains filtered or unexported fields
}
ServerCommand runs the transitland API server.
func (*ServerCommand) AddFlags ¶ added in v1.3.0
func (cmd *ServerCommand) AddFlags(fl *pflag.FlagSet)
func (*ServerCommand) HelpArgs ¶ added in v1.3.0
func (cmd *ServerCommand) HelpArgs() string
func (*ServerCommand) HelpDesc ¶ added in v1.3.0
func (cmd *ServerCommand) HelpDesc() (string, string)
func (*ServerCommand) Parse ¶ added in v1.3.0
func (cmd *ServerCommand) Parse(args []string) error
type StatsRemoveOnestopIDsCommand ¶ added in v1.4.0
type StatsRemoveOnestopIDsCommand struct {
FVArgs FeedVersionArgs
Workers int
DBURL string
DryRun bool
Adapter tldb.Adapter // allow for mocks
}
StatsRemoveOnestopIDsCommand removes onestop_id stats (agency/route/stop) for feed versions, e.g. to enforce a feed's onestop_id retention period. The feed versions themselves are unaffected; the removed rows only power AllowPrevious lookups. The active and materialized feed versions are always skipped.
func (*StatsRemoveOnestopIDsCommand) AddFlags ¶ added in v1.4.0
func (cmd *StatsRemoveOnestopIDsCommand) AddFlags(fl *pflag.FlagSet)
func (*StatsRemoveOnestopIDsCommand) HelpArgs ¶ added in v1.4.0
func (cmd *StatsRemoveOnestopIDsCommand) HelpArgs() string
func (*StatsRemoveOnestopIDsCommand) HelpDesc ¶ added in v1.4.0
func (cmd *StatsRemoveOnestopIDsCommand) HelpDesc() (string, string)
func (*StatsRemoveOnestopIDsCommand) Parse ¶ added in v1.4.0
func (cmd *StatsRemoveOnestopIDsCommand) Parse(args []string) error
type SyncCommand ¶
type SyncCommand struct {
DBURL string
Adapter tldb.Adapter // allow for mocks
sync.Options
// contains filtered or unexported fields
}
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) HelpExample ¶ added in v1.3.1
func (cmd *SyncCommand) HelpExample() string
func (*SyncCommand) Parse ¶
func (cmd *SyncCommand) Parse(args []string) error
Parse command line options.
type UnimportCommand ¶
type UnimportCommand struct {
FVArgs FeedVersionArgs
ScheduleOnly bool
ExtraTables []string
DryRun bool
DBURL string
Workers int
Adapter tldb.Adapter // allow for mocks
}
UnimportCommand removes previously imported data from feed versions.
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
type ValidatorCommand ¶
type ValidatorCommand struct {
Options validator.Options
OutputFile string
Quiet bool
DBURL string
FVID int
SaveValidationReport bool
ValidationReportStorage string
SecretsFile string
SecretEnv []string
DMFRFile string
FeedID string
URLType string
AllowFTPFetch bool
AllowLocalFetch bool
AllowS3Fetch bool
AllowHTTPFetchUnfiltered bool
AllowPartial bool
// contains filtered or unexported fields
}
ValidatorCommand validates a GTFS feed.
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
Source Files
¶
- aliases.go
- checksum_cmd.go
- cmds.go
- copy_cmd.go
- delete_cmd.go
- dmfr_cmd.go
- dmfr_format_cmd.go
- dmfr_from_dir_cmd.go
- dmfr_lint_cmd.go
- extract_cmd.go
- feed_state_cmd.go
- feed_version_args.go
- fetch_cmd.go
- import_cmd.go
- merge_cmd.go
- rebuild_stats.go
- rt_convert_cmd.go
- server_cmd.go
- stats_remove_onestop_ids_cmd.go
- sync_cmd.go
- unimport_cmd.go
- validator_cmd.go