uritemplates

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: BSD-3-Clause Imports: 13 Imported by: 4

Documentation

Overview

Copyright 2025 The Joe-cli Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2023 The Joe-cli Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2025 The Joe-cli Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2025 The Joe-cli Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand() cli.Action

func FlagsAndArgs

func FlagsAndArgs() cli.Action

func SetPartialExpand

func SetPartialExpand(b ...bool) cli.Action

func SetURITemplateVar

func SetURITemplateVar(v ...*Var) cli.Action

func SetURITemplateVars

func SetURITemplateVars(v ...*Vars) cli.Action

func SourceAnnotation

func SourceAnnotation() (string, string)

SourceAnnotation gets the name and value of the annotation added to the Data of all flags that are initialized from this package

Types

type URITemplate

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

URITemplate is a parsed representation of a URI template, which can also be used as a flag Value

func Parse

func Parse(text string) (*URITemplate, error)

func (*URITemplate) Expand

func (u *URITemplate) Expand(value any) (string, error)

func (*URITemplate) MarshalText

func (u *URITemplate) MarshalText() ([]byte, error)

MarshalText provides the textual representation

func (*URITemplate) Names

func (u *URITemplate) Names() []string

func (*URITemplate) PartialExpand

func (u *URITemplate) PartialExpand(value any) (string, error)

func (*URITemplate) Set

func (u *URITemplate) Set(arg string) error

func (*URITemplate) String

func (u *URITemplate) String() string

func (*URITemplate) UnmarshalText

func (u *URITemplate) UnmarshalText(b []byte) error

UnmarshalText converts the textual representation

type Var

type Var struct {
	Name  string
	Value any
	// contains filtered or unexported fields
}

Var is a variable in a URI template

func ArrayVar

func ArrayVar(name string, values ...any) *Var

func MapVar

func MapVar(name string, values map[string]any) *Var

func StringVar

func StringVar(name string, value string) *Var

func (*Var) Copy

func (v *Var) Copy() *Var

func (*Var) NewCounter

func (v *Var) NewCounter() cli.ArgCounter

func (*Var) Reset

func (v *Var) Reset()

func (*Var) Set

func (v *Var) Set(arg string) error

func (*Var) String

func (v *Var) String() string

func (*Var) Synopsis

func (*Var) Synopsis() string

func (*Var) Type

func (v *Var) Type() VarType

type VarType

type VarType int

VarType enumerates the types of variables in the expression of a URI template

const (
	String VarType = iota
	Array
	Map
)

Types of variables

func (VarType) String

func (t VarType) String() string

type Vars

type Vars map[string]any

Vars provides template variables

func (Vars) Add

func (t Vars) Add(v ...*Var)

func (*Vars) Copy

func (t *Vars) Copy() *Vars

func (Vars) Items

func (t Vars) Items() []*Var

func (*Vars) Reset

func (t *Vars) Reset()

func (*Vars) Set

func (t *Vars) Set(arg string) error

func (Vars) String

func (t Vars) String() string

func (Vars) Update

func (t Vars) Update(u map[string]any) (err error)

Jump to

Keyboard shortcuts

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