awesome-framework: Index | Files | Directories

package awesomefw

import ""


Package Files

byname.go compile.go config_v2.go html.go markdown.go meta.go tabsep.go testoffs.go


const NA = "N/A"

Just N/A


var NameUrlDescTabSepPattern = []string{"name", "url", "desc"}

func Compile Uses

func Compile(in io.Reader, size int, out io.Writer, inFF *InputFileFormat, outFF *OutputFileFormat, apis *ApisCfg)

Parses the file conforming to inFF and writes the output of outFF to out. The size argument is used to provide a progressbar. The apis config is forwarded to FetchMeta.

func CompileFile Uses

func CompileFile(inpPath string, out io.Writer, inFF *InputFileFormat, outFF *OutputFileFormat, apis *ApisCfg)

Opens the file and runs Compile

func ExecuteConfig Uses

func ExecuteConfig(data []byte, apis *ApisCfg) []error

func ExecuteConfigFile Uses

func ExecuteConfigFile(f string, apis *ApisCfg) []error

type ApiCfg Uses

type ApiCfg struct {
    // This is an access token passed to the API
    // NOTE: Make sure your access tokens aren't in the source code.
    AccessToken string

    // This variable specifies how many requests should be made to the API before falling back to a default response.
    // NOTE: This should only be used for development purposes.
    MaxRequests int

This is used by FetchMeta to get the access token and the maximum number of requests for any given API.

type ApisCfg Uses

type ApisCfg struct {
    UseProgressBar bool
    GitHubCfg      *ApiCfg

This holds ApiCfgs for each API used by FetchMeta

func GetApisFromEnv Uses

func GetApisFromEnv(prefix string) (*ApisCfg, error)

func NewDebugCfg Uses

func NewDebugCfg() *ApisCfg

func NewDebugReqsApisCfg Uses

func NewDebugReqsApisCfg() *ApisCfg

type Ctx Uses

type Ctx struct {
    // This is the context for the IFF
    InFFCtx map[string]interface{}

    // This is the context for the OFF
    OutFFCtx map[string]interface{}

    // This is the API config passed to FetchMeta
    ApisCfg *ApisCfg
    // contains filtered or unexported fields

This is the context that is passed between the IFF, OFF, FetchMeta and many more.

func NewCtx Uses

func NewCtx(apis *ApisCfg) *Ctx

func NewDebugCtx Uses

func NewDebugCtx() *Ctx

type InputFileFormat Uses

type InputFileFormat struct {
    // This function should parse a line and call either outFF.Item() or outFF.Literal()
    ParseLine func(out io.Writer, l string, outFF *OutputFileFormat, ctx *Ctx)

The file format according to which the input will be parsed.

func IFFByName Uses

func IFFByName(name string) (*InputFileFormat, error)

func IFFMarkdown Uses

func IFFMarkdown(sep string) *InputFileFormat

Parses the code according to this pattern:

* [<name>](<url>) - <desc>

sep: " - "

func IFFTabSep Uses

func IFFTabSep(fields []string) *InputFileFormat

Parses the code according to this pattern:

"literal line
'literal without newline
" continuation of previous line
block literal
which spans over
multiple lines

type Item Uses

type Item struct {
    Name    string
    Url     string
    RepoUrl string
    Desc    string

An Item usually consists at least of a name, url and description

type Meta Uses

type Meta interface {
    // The number of stars or N/A
    Stars() string

    // The number of forks or N/A
    Forks() string

    // The number of issues or N/A
    Issues() string

    // The date of the last commit or N/A
    LastCommit() string

Metadata about a repository

func FetchMeta Uses

func FetchMeta(url string, ctx *Ctx) Meta

Fetches a Meta object from the APIs For supported URL schemas see the tests in meta_test.go/TestFetchMeta()

type OutputFileFormat Uses

type OutputFileFormat struct {
    // This should write the literal l to out
    Literal func(out io.Writer, l string, ctx *Ctx)

    // This should write the formatted item to out
    Item func(out io.Writer, item *Item, ctx *Ctx)

    // This function is called to initialize the OFF and it's context. It can be nil.
    Start func(out io.Writer, ctx *Ctx)

    // This function is called to teardown the OFF and it's context. It can be nil.
    End func(out io.Writer, ctx *Ctx)

The output file format

func OFFByName Uses

func OFFByName(name string) (*OutputFileFormat, error)

func OFFHtml Uses

func OFFHtml() *OutputFileFormat

func OFFMarkdown Uses

func OFFMarkdown() *OutputFileFormat

Prints the code according to this pattern:

| Stars   | Forks   | Issues   | Last Commit   | Name            | Desc   |
| <stars> | <forks> | <issues> | <last commit> | [<name>](<url>) | <desc> |

func OFFMarkdownHtml Uses

func OFFMarkdownHtml() *OutputFileFormat

Same as OFFMarkdown but compiled to HTML by

func OFFSimpleMarkdown Uses

func OFFSimpleMarkdown() *OutputFileFormat

Prints the code according to this pattern:

| Name            | Desc   |
| [<name>](<url>) | <desc> |

func OFFSimpleMarkdownHtml Uses

func OFFSimpleMarkdownHtml() *OutputFileFormat

Same as OFFSimpleMarkdown but compiled to HTML by

func OFFTabSep Uses

func OFFTabSep(fields []string) *OutputFileFormat

Prints the code according to this pattern:

"literal line
'literal without newline
" continuation of previous line
"block literal
"which spans over
"multiple lines

func OFFTestAlphabetical Uses

func OFFTestAlphabetical() *OutputFileFormat

Panics if the items aren't alphabetically sorted. Nothing is written to out



Package awesomefw imports 15 packages (graph) and is imported by 1 packages. Updated 2019-03-26. Refresh now. Tools for package owners.