run

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	ExitCodeUnknownError  = 1
	ExitCodeInvalidArgs   = 2
	ExitCodeInvalidFormat = 3
	ExitCodeRunError      = 4
)

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(from error) int

ExitCode returns exit code from passed error. If passed error or its wrapped error doesn't implement ExitCode, it returns ExitCodeUnknownError. See also ExitError.

func File

func File(ctx context.Context, run *file.Run) error

func Help

func Help() string

Help returns text with manual for user.

func WithArgs

func WithArgs(ctx context.Context, args []string) error

WithArgs performs run with specific arguments.

func WithOS

func WithOS()

WithOS is wrapper for WithArgs with NewContext(context.Background()) and os.Args. It also handles returned error and exit code.

Types

type Context

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

Context represents cancelable context which also reacts to os.Interrupt signal.

func NewContext

func NewContext(parent context.Context) *Context

NewContext returns new Context based on parent.

func (*Context) Cancel

func (c *Context) Cancel()

Cancel context and stops listening. It can be called repeatedly and safely from simultaneous goroutines.

func (*Context) Deadline

func (c *Context) Deadline() (deadline time.Time, ok bool)

func (*Context) Done

func (c *Context) Done() <-chan struct{}

func (*Context) Err

func (c *Context) Err() error

func (*Context) Value

func (c *Context) Value(key any) any

type ExitCodeBearer

type ExitCodeBearer interface {
	ExitCode() int
}

ExitCodeBearer represents value with specified exit code. See also ExitCode or ExitError.

type ExitError

type ExitError struct {
	Code int
	Err  error
}

ExitError represents error with specified exit code.

func NewExitError

func NewExitError(code int, err error) *ExitError

NewExitError creates new ExitError.

func (*ExitError) ErrString

func (e *ExitError) ErrString() string

ErrString returns string representation of Err. If e or Err is nil, it returns value "unknown error".

func (*ExitError) Error

func (e *ExitError) Error() string

Error returns string representation of error.

func (*ExitError) ExitCode

func (e *ExitError) ExitCode() int

ExitCode returns specified exit code.

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

Unwrap returns wrapped error if any.

type FileErrors

type FileErrors []error

func (*FileErrors) AppendIfError

func (f *FileErrors) AppendIfError(prefix string, err error)

func (FileErrors) Error

func (f FileErrors) Error() string

func (FileErrors) ErrorOrNilIfEmpty

func (f FileErrors) ErrorOrNilIfEmpty() error

func (FileErrors) ExitCode

func (FileErrors) ExitCode() int

Directories

Path Synopsis
Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus
Ema.Tools - Publishing Reworked Copyright (C) 2026 Team Quadrimus

Jump to

Keyboard shortcuts

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