command

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Overview

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright ©️ Ant Group. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	Byte int64 = 1 << (iota * 10)
	KiByte
	MiByte
	GiByte
	TiByte
	PiByte
	EiByte
)
View Source
const (
	MAX_SHOW_BINARY_BLOB = 10<<20 - 8
)

Variables

View Source
var (
	ErrLocalEndpoint    = errors.New("local endpoint")
	ErrWorktreeNotEmpty = errors.New("worktree not empty")
)
View Source
var (
	ErrSyntaxSize = errors.New("size synatx error")
)

Functions

func ExpireDecoder

func ExpireDecoder() kong.MapperFunc

expire

func NewPrinter

func NewPrinter(ctx context.Context) *printer

func SizeDecoder

func SizeDecoder() kong.MapperFunc

func W

func W(a string) string

Types

type Az

type Az struct {
	Paths    []string `arg:"" name:"path" help:"Path to repositories" default:"." type:"path"`
	Limit    int64    `short:"L" name:"limit" optional:"" help:"Large file limit size, supported units: KB,MB,GB,K,M,G" default:"10m" type:"size"`
	FullPath bool     `short:"F" name:"full-path" help:"Show full path"`
}

func (*Az) Run

func (c *Az) Run(g *Globals) error

type Cat

type Cat struct {
	Object   string `arg:"" name:"object" help:"The name of the object to show"`
	CWD      string `short:"C" name:"cwd" help:"Specify repository location" default:"." type:"path"`
	Type     bool   `name:"type" short:"t" help:"Show object type"`
	Size     bool   `name:"size" short:"s" help:"Show object size"`
	Textconv bool   `name:"textconv" help:"Converting text to Unicode"`
	JSON     bool   `name:"json" short:"j" help:"Returns data as JSON; limited to commits, trees, and tags"`
	Limit    int64  `` /* 143-byte string literal not displayed */
	Output   string `name:"output" help:"Output to a specific file instead of stdout" placeholder:"<file>"`
}

func (*Cat) NewFD

func (c *Cat) NewFD() (io.WriteCloser, term.Level, error)

func (*Cat) Println

func (c *Cat) Println(a ...any) error

func (*Cat) Run

func (c *Cat) Run(g *Globals) error

type Co

type Co struct {
	From        string   `arg:"" name:"from" help:"Original repository remote URL" type:"string"`
	Destination string   `arg:"" optional:"" name:"destination" help:"Destination for the new repository" type:"path"`
	Branch      string   `` /* 164-byte string literal not displayed */
	Commit      string   `` /* 164-byte string literal not displayed */
	Sparse      []string `name:"sparse" short:"s" help:"A subset of repository files, all files are checked out by default" type:"string"`
	Depth       int      `name:"depth" short:"d" help:"Create a shallow clone with a history truncated to the specified number of commits" default:"5"`
	Limit       int64    `` /* 143-byte string literal not displayed */
	Recursive   bool     `` /* 131-byte string literal not displayed */
	Values      []string `short:"X" shortonly:"" help:"Override default clone/fetch configuration, format: <key>=<value>"`
}

func (*Co) Run

func (c *Co) Run(g *Globals) error

type ExpireRefs

type ExpireRefs struct {
	Pattern []string      `arg:"" optional:"" name:"pattern" help:"Matching pattern, all references are displayed by default"`
	CWD     string        `short:"C" name:"cwd" help:"Specify repository location" default:"." type:"path"`
	Merged  bool          `short:"M" name:"merged" help:"Only clean up merged branches, ignoring expiration times"`
	Tag     bool          `short:"T" name:"tag" help:"Clean up expired Tags, off by default"`
	Expires time.Duration `short:"E" name:"expires" help:"Reference expiration time, support: m, h, d, w" type:"expire" default:"90d"`
}

func (*ExpireRefs) Expire

func (c *ExpireRefs) Expire(ref *refs.Reference) bool

func (*ExpireRefs) Match

func (c *ExpireRefs) Match(name string) bool

func (*ExpireRefs) Run

func (c *ExpireRefs) Run(g *Globals) error

type Globals

type Globals struct {
	Verbose bool        `short:"V" help:"Make the operation more talkative"`
	Version VersionFlag `short:"v" name:"version" help:"Show version number and quit"`
}

func (*Globals) RunEx

func (g *Globals) RunEx(ctx context.Context, repoPath string, cmdArg0 string, args ...string) error

type Graft

type Graft struct {
	Paths    []string `arg:"" name:"path" help:"Path to repositories" default:"." type:"path"`
	Limit    int64    `short:"L" name:"limit" optional:"" help:"Large file limit size, supported units: KB,MB,GB,K,M,G" default:"20m" type:"size"`
	Confirm  bool     `short:"Y" name:"confirm" help:"Confirm rewriting local branches and tags"`
	Prune    bool     `short:"P" name:"prune" help:"Prune repository when commits are rewritten"`
	HeadOnly bool     `short:"H" name:"head-only" help:"Graft only the default branch"`
	FullPath bool     `short:"F" name:"full-path" help:"Show full path"`
	ALL      bool     `short:"A" name:"all" help:"Remove all large blobs"`
}

func (*Graft) Run

func (c *Graft) Run(g *Globals) error

type Mc

type Mc struct {
	From        string `arg:"" name:"from" help:"Original repository remote URL (or filesystem path)" type:"string"`
	Destination string `arg:"" optional:"" name:"destination" help:"Destination where the repository is migrated" type:"path"`
	Format      string `name:"format" default:"sha256" help:"Specifying the object format, support only: sha1 or sha256"`
	Bare        bool   `short:"b" name:"bare" optional:"" help:"Save as a bare git repository"`
}

func (*Mc) Run

func (c *Mc) Run(g *Globals) error

type NopWriteCloser

type NopWriteCloser struct {
	io.Writer
}

func (NopWriteCloser) Close

func (NopWriteCloser) Close() error

type Printer

type Printer interface {
	io.WriteCloser
	ColorMode() term.Level
	EnableColor() bool
}

type PruneRefs

type PruneRefs struct {
	Prefixes []string      `arg:"" optional:"" name:"prefixes" help:"Reference prefixes that need to be cleaned up"` // to targets
	CWD      string        `short:"C" name:"cwd" help:"Specify repository location" default:"." type:"path"`
	Expires  time.Duration `short:"e" name:"expires" help:"Reference expiration time, support: m, h, d, w" type:"expire" default:"90d"`
	DryRun   bool          `name:"dry-run" short:"n" help:"Dry run"`
	Default  bool          `short:"D" name:"default" help:"Cleanup references using default prefix"`
	Extreme  bool          `short:"E" name:"extreme" help:"Remove more dirty references"`
}

func (*PruneRefs) Run

func (c *PruneRefs) Run(g *Globals) error

type Reference

type Reference struct {
	Name       string    `json:"name"`
	ShortName  string    `json:"short_name"`
	Hash       string    `json:"hash"`
	Committer  string    `json:"committer"`
	LastUpdate time.Time `json:"last_update"`
}

func GetReferences

func GetReferences(ctx context.Context, repoPath string, m func(*Reference) bool) ([]*Reference, error)

type Remove

type Remove struct {
	CWD      string   `short:"C" name:"cwd" help:"Specify repository location" default:"." type:"path"`
	Paths    []string `arg:"" name:"Paths" help:"Path to remove in repository, support wildcards" type:"string"`
	Confirm  bool     `short:"Y" name:"confirm" help:"Confirm rewriting local branches and tags"`
	Prune    bool     `short:"P" name:"prune" help:"Prune repository when commits are rewritten"`
	Graft    bool     `short:"G" name:"graft" help:"Grafting mode"`
	HeadOnly bool     `short:"H" name:"head-only" help:"Graft only the default branch"`
}

func (*Remove) Run

func (c *Remove) Run(g *Globals) error

type ScanRefs

type ScanRefs struct {
	Pattern []string `arg:"" optional:"" name:"pattern" help:"Matching pattern, all references are displayed by default"`
	CWD     string   `short:"C" name:"cwd" help:"Specify repository location" default:"." type:"path"`
	Oldest  bool     `short:"O" name:"oldest" help:"Sort by time from oldest to newest"`
}

func (*ScanRefs) Match

func (c *ScanRefs) Match(name string) bool

func (*ScanRefs) Run

func (c *ScanRefs) Run(g *Globals) error

type Size

type Size struct {
	Paths    []string `arg:"" name:"path" help:"Path to repositories" default:"." type:"path"`
	Limit    int64    `short:"L" name:"limit" optional:"" help:"Large file limit size, supported units: KB,MB,GB,K,M,G" default:"20m" type:"size"`
	Extract  bool     `short:"E" name:"extract" optional:"" help:"Whether large files exist in the default branch"`
	FullPath bool     `short:"F" name:"full-path" help:"Show full path"`
}

func (*Size) Run

func (c *Size) Run(g *Globals) error

type Smart

type Smart struct {
	Paths    []string `arg:"" name:"path" help:"Path to repositories" default:"." type:"path"`
	Limit    int64    `short:"L" name:"limit" optional:"" help:"Large file limit size, supported units: KB,MB,GB,K,M,G" default:"20m" type:"size"`
	Confirm  bool     `short:"Y" name:"confirm" help:"Confirm rewriting local branches and tags"`
	Prune    bool     `short:"P" name:"prune" help:"Prune repository when commits are rewritten"`
	FullPath bool     `short:"F" name:"full-path" help:"Show full path"`
	ALL      bool     `short:"A" name:"all" help:"Remove all large blobs"`
}

func (*Smart) Run

func (c *Smart) Run(g *Globals) error

type Snapshot

type Snapshot struct {
	Message        []string `name:"message" short:"m" help:"Use the given as the commit message. Concatenate multiple -m options as separate paragraphs"`
	File           string   `name:"file" short:"F" help:"Take the commit message from the given file. Use - to read the message from the standard input"`
	Parents        []string `name:"parents" short:"p" help:"ID of a parent commit object"`
	CWD            string   `short:"C" name:"cwd" help:"Specify repository location" default:"." type:"path"`
	Orphan         bool     `name:"orphan" help:"Create an orphan commit"`
	Push           bool     `name:"push" short:"P" help:"Push the worktree snapshot commit to the remote"`
	Force          bool     `name:"force" short:"f" help:"Force updates"`
	UnresolvedArgs []string `arg:"" optional:"" hidden:""`
	// contains filtered or unexported fields
}

func (*Snapshot) Passthrough

func (c *Snapshot) Passthrough(paths []string)

func (*Snapshot) Run

func (c *Snapshot) Run(g *Globals) error

func (*Snapshot) Summary

func (c *Snapshot) Summary() string

type Stat

type Stat struct {
	CWD   string `short:"C" name:"cwd" help:"Specify repository location" default:"." type:"path"`
	Limit int64  `short:"L" name:"limit" optional:"" help:"Large file limit size, supported units: KB,MB,GB,K,M,G" default:"20m" type:"size"`
}

func (*Stat) Run

func (c *Stat) Run(g *Globals) error

type Unbranch

type Unbranch struct {
	Revision string `arg:"" optional:"" name:"revision" help:"Linearize the specified revision history"`
	CWD      string `short:"C" name:"cwd" help:"Specify repository location" default:"." type:"path"`
	Confirm  bool   `short:"Y" name:"confirm" help:"Confirm rewriting local branches and tags"`
	Prune    bool   `short:"P" name:"prune" help:"Prune repository when commits are rewritten"`
	Target   string `short:"T" name:"target" help:"Save linearized branches to new target"`
	Keep     int    `short:"K" name:"keep" help:"Keep the number of commits, 0 keeps all commits"`
}

func (*Unbranch) Run

func (c *Unbranch) Run(g *Globals) error

type VersionFlag

type VersionFlag bool

func (VersionFlag) BeforeApply

func (v VersionFlag) BeforeApply(app *kong.Kong, vars kong.Vars) error

func (VersionFlag) Decode

func (v VersionFlag) Decode(ctx *kong.DecodeContext) error

func (VersionFlag) IsBool

func (v VersionFlag) IsBool() bool

type WrapPrinter

type WrapPrinter struct {
	io.WriteCloser
}

func (WrapPrinter) ColorMode

func (WrapPrinter) ColorMode() term.Level

func (WrapPrinter) EnableColor

func (WrapPrinter) EnableColor() bool

Jump to

Keyboard shortcuts

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