cmd

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const CodeforcesContestRegStr = `\d+`
View Source
const CodeforcesGroupRegStr = `\w{10}`
View Source
const CodeforcesProblemRegStr = `\w+`
View Source
const CodeforcesStrictProblemRegStr = `[a-zA-Z]+\d*`
View Source
const CodeforcesSubmissionRegStr = `\d+`
View Source
const OIContestRegStr = `[MCLXVI]+`
View Source
const OIStageRegStr = `[1-3]`
View Source
const StrictSzkopulProblemRegStr = `[a-z]{3}\d*`
View Source
const SzkopulProblemRegStr = `\w+`
View Source
const SzkopulProblemSecretKeyRegStr = `[A-Za-z0-9]{24}`

Variables

View Source
var CodeforcesArgRegStr = [...]string{
	`^[cC][oO][nN][tT][eE][sS][tT][sS]?$`,
	`^[gG][yY][mM][sS]?$`,
	`^[gG][rR][oO][uU][pP][sS]?$`,
	`^[aA][cC][mM][sS][gG][uU][rR][uU]$`,
	fmt.Sprintf(`/contest/(?P<contestID>%v)(/problem/(?P<problemID>%v))?`, CodeforcesContestRegStr, CodeforcesProblemRegStr),
	fmt.Sprintf(`/gym/(?P<contestID>%v)(/problem/(?P<problemID>%v))?`, CodeforcesContestRegStr, CodeforcesProblemRegStr),
	fmt.Sprintf(`/problemset/problem/(?P<contestID>%v)/(?P<problemID>%v)`, CodeforcesContestRegStr, CodeforcesProblemRegStr),
	fmt.Sprintf(`/group/(?P<groupID>%v)(/contest/(?P<contestID>%v)(/problem/(?P<problemID>%v))?)?`, CodeforcesGroupRegStr, CodeforcesContestRegStr, CodeforcesProblemRegStr),
	fmt.Sprintf(`/problemsets/acmsguru/problem/(?P<contestID>%v)/(?P<problemID>%v)`, CodeforcesContestRegStr, CodeforcesProblemRegStr),
	fmt.Sprintf(`/problemsets/acmsguru/submission/(?P<contestID>%v)/(?P<submissionID>%v)`, CodeforcesContestRegStr, CodeforcesSubmissionRegStr),
	fmt.Sprintf(`/submission/(?P<submissionID>%v)`, CodeforcesSubmissionRegStr),
	fmt.Sprintf(`^(?P<contestID>%v)(?P<problemID>%v)$`, CodeforcesContestRegStr, CodeforcesStrictProblemRegStr),
	fmt.Sprintf(`^(?P<contestID>%v)$`, CodeforcesContestRegStr),
	fmt.Sprintf(`^(?P<problemID>%v)$`, CodeforcesStrictProblemRegStr),
	fmt.Sprintf(`^(?P<groupID>%v)$`, CodeforcesGroupRegStr),
}
View Source
var CodeforcesArgType = [...]string{
	"contest",
	"gym",
	"group",
	"acmsguru",
	"contest",
	"gym",
	"contest",
	"group",
	"acmsguru",
	"acmsguru",
	"",
	"",
	"",
	"",
	"",
}
View Source
var CodeforcesArgTypePathRegStr = [...]string{
	fmt.Sprintf("%v/%v/((?P<contestID>%v)/((?P<problemID>%v)/)?)?", "%v", "%v", CodeforcesContestRegStr, CodeforcesProblemRegStr),
	fmt.Sprintf("%v/%v/((?P<contestID>%v)/((?P<problemID>%v)/)?)?", "%v", "%v", CodeforcesContestRegStr, CodeforcesProblemRegStr),
	fmt.Sprintf("%v/%v/((?P<groupID>%v)/((?P<contestID>%v)/((?P<problemID>%v)/)?)?)?", "%v", "%v", CodeforcesGroupRegStr, CodeforcesContestRegStr, CodeforcesProblemRegStr),
	fmt.Sprintf("%v/%v/((?P<problemID>%v)/)?", "%v", "%v", CodeforcesProblemRegStr),
}
View Source
var SzkopulArgRegStr = [...]string{
	`^[oO][iI]?$`,
	fmt.Sprintf(`/problemset/problem/(?P<problemSecretKey>%v)(/site(/\?key=\w+)?)?`, SzkopulProblemSecretKeyRegStr),
	fmt.Sprintf(`^(?P<problemSecretKey>%v)$`, SzkopulProblemSecretKeyRegStr),
	fmt.Sprintf(`^(?P<problemID>%v)$`, StrictSzkopulProblemRegStr),
	fmt.Sprintf(`^(?P<contestID>%v)$`, OIContestRegStr),
	fmt.Sprintf(`^(?P<stageID>%v)$`, OIStageRegStr),
}
View Source
var SzkopulArgType = [...]string{
	"OI",
	"OI",
	"OI",
	"OI",
	"OI",
	"OI",
}
View Source
var SzkopulPathRegStr = [...]string{
	fmt.Sprintf("%v/%v/((?P<contestID>%v)/((?P<stageID>%v)/((?P<problemID>%v)/)?)?)?", "%v", "%v", OIContestRegStr, OIStageRegStr, StrictSzkopulProblemRegStr),
}

Functions

func CodeforcesList

func CodeforcesList() (err error)

List command

func CodeforcesOpen

func CodeforcesOpen() (err error)

Open command

func CodeforcesParse

func CodeforcesParse() (err error)

Parse command

func CodeforcesPull

func CodeforcesPull() (err error)

Pull command

func CodeforcesRace

func CodeforcesRace() (err error)

Race command

func CodeforcesSid

func CodeforcesSid() (err error)

Sid command

func CodeforcesStand

func CodeforcesStand() (err error)

Stand command

func CodeforcesSubmit

func CodeforcesSubmit() (err error)

Submit command

func CodeforcesWatch

func CodeforcesWatch() (err error)

Watch command

func Config

func Config() (err error)

Config command

func DatabaseAdd

func DatabaseAdd() (err error)

func DatabaseFind

func DatabaseFind() (err error)

func DatabaseGoto

func DatabaseGoto() (err error)

func Eval

func Eval(opts docopt.Opts) error

Eval opts

func ExtendTaskInfo

func ExtendTaskInfo(task database_client.Task, props valuesProperties) database_client.Task

func ExtractTaskName

func ExtractTaskName(file string) (task string)

func Gen

func Gen() (err error)

Gen command

func GenFiles

func GenFiles(source, currentPath, ext string) error

func GetTaskFromArgs

func GetTaskFromArgs() database_client.Task

func ReadTask

func StressTest

func StressTest() (err error)

Stress test command

func SubPath

func SubPath(parent, sub string) bool

func SzkopulOpen

func SzkopulOpen() (err error)

Open command

func SzkopulSid

func SzkopulSid() (err error)

Sid command

func SzkopulSubmit

func SzkopulSubmit() (err error)

Submit command

func SzkopulWatch

func SzkopulWatch() (err error)

Watch command

func Test

func Test() (err error)

Test command

func Upgrade

func Upgrade() (err error)

Upgrade itself

Types

type CodeList

type CodeList struct {
	Name  string
	Index []int
}

CodeList Name matches some template suffix, index are template array indexes

type ParsedArgs

type ParsedArgs struct {
	CodeforcesInfo codeforces_client.Info
	SzkopulInfo    szkopul_client.Info
	File           string
	Generator      string
	Solve          string
	Brute          string
	Source         string
	Name           string
	Path           string
	Link           string
	Shortname      string
	Contest        string
	Stage          string
	Specifier      []string `docopt:"<specifier>"`
	Alias          string   `docopt:"<alias>"`
	Accepted       bool     `docopt:"ac"`
	All            bool     `docopt:"all"`
	Handle         string   `docopt:"<handle>"`
	Version        string   `docopt:"{version}"`
	Config         bool     `docopt:"config"`
	Submit         bool     `docopt:"submit"`
	List           bool     `docopt:"list"`
	Parse          bool     `docopt:"parse"`
	Gen            bool     `docopt:"gen"`
	Test           bool     `docopt:"test"`
	Watch          bool     `docopt:"watch"`
	Open           bool     `docopt:"open"`
	Stand          bool     `docopt:"stand"`
	Sid            bool     `docopt:"sid"`
	Race           bool     `docopt:"race"`
	Pull           bool     `docopt:"pull"`
	Clone          bool     `docopt:"clone"`
	Upgrade        bool     `docopt:"upgrade"`
	StressTest     bool     `docopt:"stress-test"`
	Database       bool     `docopt:"db"`
	Add            bool     `docopt:"add"`
	Find           bool     `docopt:"find"`
	Goto           bool     `docopt:"goto"`
	Codeforces     bool
	Szkopul        bool
}

ParsedArgs parsed arguments

var Args *ParsedArgs

Args global variable

type ProcessInfo

type ProcessInfo struct {
	// contains filtered or unexported fields
}

type Verdict

type Verdict struct {
	// contains filtered or unexported fields
}

type WriteCounter

type WriteCounter struct {
	Count, Total uint
	// contains filtered or unexported fields
}

WriteCounter progress counter

func (*WriteCounter) Print

func (w *WriteCounter) Print()

Print print progress

func (*WriteCounter) Write

func (w *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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