startup

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 6 Imported by: 1

README ΒΆ

Startup

Go Report Card GoDoc codecov GitHub license tag

✨ xuender/startup is a startup Go library based on Go 1.18+ Generics.

πŸš€ Install

go get github.com/xuender/startup@latest

πŸ’‘ Usage

You can import startup using:

import "github.com/xuender/startup"
Install

Then install startup:

startup.Install()
// or
startup.Install(args...)
Uninstall

Then uninstall startup:

startup.Uninstall()
Status

Then startup status:

startup.Status()

// true or false

😁 Cover

codecov

πŸ“ License

Copyright Β© 2022~time.Now Xuender.

This project is MIT licensed.

Documentation ΒΆ

Overview ΒΆ

Example ΒΆ

nolint: testableexamples

package main

import (
	"fmt"

	"github.com/xuender/startup"
)

func main() {
	fmt.Println(startup.Status())
	fmt.Println(startup.Install("-n", 1))
	fmt.Println(startup.Uninstall())
}
Output:

Index ΒΆ

Examples ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

View Source
var ErrEmptyCommand = errors.New("command is empty")

Functions ΒΆ

func CommandPath ΒΆ added in v1.0.2

func CommandPath() (string, error)

CommandPath returns command path.

func CrontabList ΒΆ added in v1.0.3

func CrontabList() ([]byte, error)

func CrontabUpdate ΒΆ added in v1.0.3

func CrontabUpdate(data []byte) error

func Include ΒΆ

func Include(command string) bool

Include command.

func Install ΒΆ

func Install(args ...any) error

Install startup.

func Remove ΒΆ

func Remove(command string) error

Remove command.

func Startup ΒΆ

func Startup(command string) error

Startup set command auto start.

Example ΒΆ

nolint: testableexamples

package main

import (
	"fmt"

	"github.com/xuender/startup"
)

func main() {
	fmt.Println(startup.Include("echo 1"))
	fmt.Println(startup.Startup("echo 1"))
	fmt.Println(startup.Remove("echo 1"))
}
Output:

func Status ΒΆ

func Status() bool

Status by install.

func Uninstall ΒΆ

func Uninstall() error

Uninstall startup.

Types ΒΆ

This section is empty.

Directories ΒΆ

Path Synopsis
_example

Jump to

Keyboard shortcuts

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