user

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HWAll represents all items in the collection.
	HWAll = iota
	// HWUpdated represents problems that were already on the
	// user's filesystem, where one or more new files have been added.
	HWUpdated
	// HWNew represents problems that did not yet exist on the
	// user's filesystem.
	HWNew
	// HWNotSubmitted represents problems that have not been submitted
	// for review.
	HWNotSubmitted
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Curriculum

type Curriculum struct {
	Tracks []*api.Track
	// contains filtered or unexported fields
}

Curriculum is a collection of language tracks.

func NewCurriculum

func NewCurriculum(tracks []*api.Track) *Curriculum

NewCurriculum returns a collection of language tracks.

func (*Curriculum) Report

func (cur *Curriculum) Report(status Status)

Report creates a table of the tracks that have the requested status.

type HWFilter

type HWFilter int

HWFilter is used to categorize homework items.

type Homework

type Homework struct {
	Items []*Item
	// contains filtered or unexported fields
}

Homework is a collection of problems that were fetched from the APIs.

func NewHomework

func NewHomework(problems []*api.Problem, c *config.Config) *Homework

NewHomework decorates a problem set with some additional data based on the user's system.

func (*Homework) ItemsMatching

func (hw *Homework) ItemsMatching(filter HWFilter) []*Item

ItemsMatching returns a subset of the set of problems.

func (*Homework) Report

func (hw *Homework) Report(filter HWFilter)

Report outputs a list of the problems in the set. It prints the track name, the problem name, and the full path to the problem on the user's filesystem.

func (*Homework) Save

func (hw *Homework) Save() error

Save saves all problems in the problem set.

func (*Homework) Summarize

func (hw *Homework) Summarize(summaryFilter SummaryOption)

Summarize prints a full report of new and updated items in the set.

type Item

type Item struct {
	*api.Problem
	// contains filtered or unexported fields
}

Item is a problem that has been fetched from the APIs. It contains some data specific to this particular request and user in order to give a useful report to the user about what has been fetched.

func (*Item) Matches

func (it *Item) Matches(filter HWFilter) bool

Matches determines whether or not this item matches the given filter.

func (*Item) Path

func (it *Item) Path() string

Path is the location of this item on the user's filesystem.

func (*Item) Report

func (it *Item) Report(template string, max int) string

Report outputs the line's string and path in the format of the passed in template.

func (*Item) Save

func (it *Item) Save() error

Save writes the embedded problem to the filesystem.

type Status

type Status bool

Status is the status of a track (active/inactive).

const (
	// TrackActive represents an active track.
	// Problems from active tracks will be delivered with the `fetch` command.
	TrackActive Status = true
	// TrackInactive represents an inactive track.
	// It is possible to fetch problems from an inactive track, and
	// submit them to the website, but these will not automatically be
	// delivered in the global `fetch` command.
	TrackInactive Status = false
)

type SummaryOption

type SummaryOption HWFilter

SummaryOption is an alias of HWFilter that allows selective display of summary items

Jump to

Keyboard shortcuts

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