Sign in

    moonbitstack/moonctl/style does not have a README file

    StyleError

    pub suberror StyleError {
    BadStyle(String)
    }

    A --style template that is not <before>GO<through>ZERO<after>: either a marker is missing (go, zero), they are the wrong way round, or one is cased neither go/GO/Go nor zero/ZERO/Zero (gOZero, goZEro).

    Case

    type Case

    The case a marker asks its words to be spelled in.

    Style

    pub struct Style {
    before : String
    through : String
    after : String
    head : Case
    tail : Case
    }

    A --style naming template (← goctl's --style), ready to spell names with. Build one with Style::parse, apply it with Style::format.

    Style::format

    fn Style::format(self : Style, name : String) -> String

    Spell name in this style. name is split into words on _ and before each capital, the first word takes the GO marker's case and the rest take ZERO's, and they are joined with whatever stood between the markers.

    Style::gozero

    fn Style::gozero() -> Style

    goctl's default style, gozero: every word lower-cased and run together.

    Style::parse

    fn Style::parse(s : String) -> Style raise StyleError

    Read a --style template. It must contain GO and then ZERO — in any case, with anything before, between and after them:

    Style::parse("gozero").format("welcome_to_go_zero") // welcometogozero Style::parse("goZero").format("welcome_to_go_zero") // welcomeToGoZero Style::parse("go_zero").format("welcome_to_go_zero") // welcome_to_go_zero Style::parse("Go#zero").format("welcome_to_go_zero") // Welcome#to#go#zero

    The GO marker's own casing (go, GO or Go) says how the first word is spelled, ZERO's says how every later word is, and what stands between the two markers is what stands between the words. A template missing a marker (go, zero), holding them in the wrong order, or casing one of them any other way (gOZero, goZEro) raises StyleError.

    Source Files