core

package
v0.0.0-...-20e01be Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CPUCmd = &cobra.Command{
	Use:   "cpu",
	Short: "Display CPU statistics",
	Run: func(cmd *cobra.Command, args []string) {
		showUsage, _ := cmd.Flags().GetBool("cu")
		showCount, _ := cmd.Flags().GetBool("cc")
		showFreq, _ := cmd.Flags().GetBool("cfreq")
		showIdle, _ := cmd.Flags().GetBool("cidle")
		showNice, _ := cmd.Flags().GetBool("cnice")
		showSteal, _ := cmd.Flags().GetBool("csteal")
		showUser, _ := cmd.Flags().GetBool("cuser")
		showSystem, _ := cmd.Flags().GetBool("csys")
		showTemp, _ := cmd.Flags().GetBool("ctemp")
		showClocks, _ := cmd.Flags().GetBool("cclk")

		if showUsage {
			usage, err := GetCPUUsage()
			if err == nil {
				fmt.Printf("CPU Usage: %.2f%%\n", usage)
			}
		}
		if showCount {
			count, err := GetCPUCount()
			if err == nil {
				fmt.Println("Logical CPU Count:", count)
			}
		}
		if showFreq {
			freqs, err := GetCPUFrequency()
			if err == nil {
				for _, info := range freqs {
					fmt.Printf("CPU: %s, Cores: %d, Speed: %.2f MHz\n", info.ModelName, info.Cores, info.Mhz)
				}
			}
		}
		if showIdle {
			idle, err := GetCPUIdle()
			if err == nil {
				fmt.Printf("CPU Idle: %.2f%%\n", idle)
			}
		}
		if showNice {
			nice, err := GetCPUNice()
			if err == nil {
				fmt.Printf("CPU Nice Time: %.2f\n", nice)
			}
		}
		if showSteal {
			steal, err := GetCPUStealTime()
			if err == nil {
				fmt.Printf("CPU Steal Time: %.2f\n", steal)
			}
		}
		if showUser {
			user, err := GetCPUUserTime()
			if err == nil {
				fmt.Printf("CPU User Time: %.2f\n", user)
			}
		}
		if showSystem {
			system, err := GetCPUSystemTime()
			if err == nil {
				fmt.Printf("CPU System Time: %.2f\n", system)
			}
		}
		if showTemp {
			temp := GetCPUTemperature()
			fmt.Printf("CPU Temperature: %.2f°C (dummy)\n", temp)
		}
		if showClocks {
			clocks := GetClocksPerSecond()
			fmt.Println("Clocks Per Second:", clocks)
		}
	},
}
View Source
var CatCmd = &cobra.Command{
	Use:   "cat",
	Short: "Concatenate and display file contents",
	Args:  cobra.ArbitraryArgs,
	Run: func(cmd *cobra.Command, args []string) {
		number, _ := cmd.Flags().GetBool("number")
		numberNonBlank, _ := cmd.Flags().GetBool("number-nonblank")
		squeezeBlank, _ := cmd.Flags().GetBool("squeeze-blank")
		showEnds, _ := cmd.Flags().GetBool("show-ends")
		showTabs, _ := cmd.Flags().GetBool("show-tabs")
		showNonPrinting, _ := cmd.Flags().GetBool("show-nonprinting")

		if len(args) >= 3 && args[len(args)-2] == "mx" {
			mergeFiles(args[:len(args)-2], args[len(args)-1])
		} else {

			if len(args) == 0 {
				displayStdin(number, numberNonBlank, squeezeBlank, showEnds, showTabs, showNonPrinting)
			} else {
				for _, file := range args {
					displayFile(file, number, numberNonBlank, squeezeBlank, showEnds, showTabs, showNonPrinting)
				}
			}
		}
	},
}
View Source
var CdCmd = &cobra.Command{
	Use:   "cd [directory]",
	Short: "Change the current working directory",
	Args:  cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		targetDir := args[0]
		if targetDir == "~" {
			usr, err := user.Current()
			if err != nil {
				log.Fatalf("Error getting user information: %v", err)
			}
			targetDir = usr.HomeDir
		} else if targetDir == ".." {
			currentDir, err := os.Getwd()
			if err != nil {
				log.Fatalf("Error getting current directory: %v", err)
			}
			targetDir = filepath.Dir(currentDir)
		}
		err := os.Chdir(targetDir)
		if err != nil {
			log.Fatalf("Error changing directory: %v", err)
		}
		newDir, err := os.Getwd()
		if err != nil {
			log.Fatalf("Error getting new directory: %v", err)
		}

		fmt.Println("Directory changed successfully to:", newDir)
	},
}
View Source
var ClearCmd = &cobra.Command{
	Use:   "clear",
	Short: "Clear the terminal screen",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Print("\033[H\033[2J")
	},
}
View Source
var DateCmd = &cobra.Command{
	Use:   "date",
	Short: "Print the current date and time",
	Run: func(cmd *cobra.Command, args []string) {
		today := time.Now()
		zone, _ := today.Zone()
		fmt.Printf("%s %s %d %02d:%02d:%02d %s %d\n",
			today.Weekday().String()[0:3],
			today.Month().String()[0:3],
			today.Day(),
			today.Hour(),
			today.Minute(),
			today.Second(),
			zone,
			today.Year())
	},
}
View Source
var DiskCmd = &cobra.Command{
	Use:   "disk",
	Short: "Display disk statistics",
	Run: func(cmd *cobra.Command, args []string) {
		showUsage, _ := cmd.Flags().GetBool("du")
		showTotal, _ := cmd.Flags().GetBool("dt")
		showFree, _ := cmd.Flags().GetBool("df")
		showUsed, _ := cmd.Flags().GetBool("dused")

		showReadBytes, _ := cmd.Flags().GetBool("drb")
		showWriteBytes, _ := cmd.Flags().GetBool("dwb")
		showReadBps, _ := cmd.Flags().GetBool("drbps")
		showWriteBps, _ := cmd.Flags().GetBool("dwbps")

		showInodesUsed, _ := cmd.Flags().GetBool("diu")
		showInodesFree, _ := cmd.Flags().GetBool("dif")
		showInodesTotal, _ := cmd.Flags().GetBool("dit")
		showSerial, _ := cmd.Flags().GetBool("dsn")

		if showUsage {
			usedPercent, used, err := GetDiskUsage()
			if err == nil {
				fmt.Printf("Disk Usage: %.2f%% (%d bytes)\n", usedPercent, used)
			}
		}
		if showTotal {
			total, err := GetDiskTotal()
			if err == nil {
				fmt.Println("Disk Total:", total)
			}
		}
		if showFree {
			free, err := GetDiskFree()
			if err == nil {
				fmt.Println("Disk Free:", free)
			}
		}
		if showUsed {
			used, err := GetDiskTotalUsed()
			if err == nil {
				fmt.Println("Disk Used:", used)
			}
		}
		if showReadBytes {
			rb, err := GetDiskReadBytes()
			if err == nil {
				fmt.Println("Disk Read Bytes:", rb)
			}
		}
		if showWriteBytes {
			wb, err := GetDiskWriteBytes()
			if err == nil {
				fmt.Println("Disk Write Bytes:", wb)
			}
		}
		if showReadBps {
			rbps, err := GetDiskReadBytesPerSecond()
			if err == nil {
				fmt.Println("Disk Read Bytes/sec:", rbps)
			}
		}
		if showWriteBps {
			wbps, err := GetDiskWriteBytesPerSecond()
			if err == nil {
				fmt.Println("Disk Write Bytes/sec:", wbps)
			}
		}
		if showInodesUsed {
			iu, err := GetDiskInodesUsed()
			if err == nil {
				fmt.Println("Disk Inodes Used:", iu)
			}
		}
		if showInodesFree {
			ifree, err := GetDiskInodesFree()
			if err == nil {
				fmt.Println("Disk Inodes Free:", ifree)
			}
		}
		if showInodesTotal {
			itotal, err := GetDiskTotalInodes()
			if err == nil {
				fmt.Println("Disk Inodes Total:", itotal)
			}
		}
		if showSerial {
			serial, err := GetDiskSerialNumber()
			if err == nil && serial != "" {
				fmt.Println("Disk Serial Number:", serial)
			} else {
				fmt.Println("Disk Serial Number: Not available")
			}
		}
	},
}
View Source
var EchoCmd = &cobra.Command{
	Use:   "echo [text]",
	Short: "Display a line of text",
	Args:  cobra.MinimumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println(strings.Join(args, " "))
	},
}
View Source
var HeadCmd = &cobra.Command{
	Use:   "head [file]",
	Short: "Display the first 10 lines of a file",
	Args:  cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		file, err := os.Open(args[0])
		checkError(err, "opening file")
		defer file.Close()

		scanner := bufio.NewScanner(file)
		for i := 0; i < 10 && scanner.Scan(); i++ {
			fmt.Println(scanner.Text())
		}
		checkError(scanner.Err(), "reading file")
	},
}
View Source
var Iamwho = &cobra.Command{
	Use:   "iamwho",
	Short: "The whoami command",
	Run: func(cmd *cobra.Command, args []string) {
		g, err := user.Current()
		if err != nil {
			fmt.Println(err.Error())
		} else {
			fmt.Println(g.Username)
		}
	},
}
View Source
var LsCmd = &cobra.Command{
	Use:   "ls",
	Short: "List directory contents",
	Run: func(cmd *cobra.Command, args []string) {
		dir, _ := cmd.Flags().GetString("directory")
		showHidden, _ := cmd.Flags().GetBool("a")
		appendSlashToDir, _ := cmd.Flags().GetBool("F")
		sortByTime, _ := cmd.Flags().GetBool("t")
		reverseOrder, _ := cmd.Flags().GetBool("r")
		sortBySize, _ := cmd.Flags().GetBool("S")
		recursive, _ := cmd.Flags().GetBool("R")
		listInode, _ := cmd.Flags().GetBool("i")
		showGroup, _ := cmd.Flags().GetBool("g")
		humanReadable, _ := cmd.Flags().GetBool("human-readable")
		listDir, _ := cmd.Flags().GetBool("list-dir")
		if dir == "" {
			dir = "."
		}

		listFiles(dir, showHidden, appendSlashToDir, sortByTime, reverseOrder, sortBySize, recursive, listInode, showGroup, humanReadable, listDir)
	},
}
View Source
var MemCmd = &cobra.Command{
	Use:   "mem",
	Short: "Display memory statistics",
	Run: func(cmd *cobra.Command, args []string) {
		showUsage, _ := cmd.Flags().GetBool("mu")
		showTotal, _ := cmd.Flags().GetBool("mt")
		showFree, _ := cmd.Flags().GetBool("mf")
		showAvailable, _ := cmd.Flags().GetBool("ma")
		showCached, _ := cmd.Flags().GetBool("mc")
		showBuffers, _ := cmd.Flags().GetBool("mb")
		showUsed, _ := cmd.Flags().GetBool("mused")

		showSwapTotal, _ := cmd.Flags().GetBool("st")
		showSwapUsed, _ := cmd.Flags().GetBool("su")
		showSwapFree, _ := cmd.Flags().GetBool("sf")

		if showUsage {
			usedPercent, used, err := GetMemoryUsage()
			if err == nil {
				fmt.Printf("Memory Usage: %.2f%% (%d bytes)\n", usedPercent, used)
			}
		}
		if showTotal {
			total, err := GetMemoryTotal()
			if err == nil {
				fmt.Println("Total Memory:", total)
			}
		}
		if showFree {
			free, err := GetMemoryFree()
			if err == nil {
				fmt.Println("Free Memory:", free)
			}
		}
		if showAvailable {
			avail, err := GetMemoryAvailable()
			if err == nil {
				fmt.Println("Available Memory:", avail)
			}
		}
		if showCached {
			cached, err := GetMemoryCached()
			if err == nil {
				fmt.Println("Cached Memory:", cached)
			}
		}
		if showBuffers {
			buffers, err := GetMemoryBuffers()
			if err == nil {
				fmt.Println("Buffer Memory:", buffers)
			}
		}
		if showUsed {
			used, err := GetMemoryTotalUsed()
			if err == nil {
				fmt.Println("Used Memory:", used)
			}
		}
		if showSwapTotal {
			swapTotal, err := GetSwapTotal()
			if err == nil {
				fmt.Println("Swap Total:", swapTotal)
			}
		}
		if showSwapUsed {
			swapUsed, err := GetSwapUsed()
			if err == nil {
				fmt.Println("Swap Used:", swapUsed)
			}
		}
		if showSwapFree {
			swapFree, err := GetSwapFree()
			if err == nil {
				fmt.Println("Swap Free:", swapFree)
			}
		}
	},
}
View Source
var MkdirCmd = &cobra.Command{
	Use:   "mkdir [dirName]",
	Short: "Create a new file",
	Long:  `The touch command creates a new file with the given dir_Name.`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 1 {
			Dir_Maker(args[0])
		} else if len(args) > 1 {
			for _, i := range args[:] {
				Dir_Maker(i)
			}
		}
	},
}
View Source
var NetCmd = &cobra.Command{
	Use:   "net",
	Short: "Display network statistics",
	Run: func(cmd *cobra.Command, args []string) {
		getNetworkTotalErrors, _ := cmd.Flags().GetBool("te")
		getNetworkPacketsDropped, _ := cmd.Flags().GetBool("pd")
		getNetworkInterfaceStats, _ := cmd.Flags().GetBool("is")
		getNetworkErrorStats, _ := cmd.Flags().GetBool("es")
		getNetworkPacketsReceived, _ := cmd.Flags().GetBool("pr")
		getNetworkPacketsSent, _ := cmd.Flags().GetBool("ps")
		getNetworkReceivedBytes, _ := cmd.Flags().GetBool("rb")
		getNetworkSentBytes, _ := cmd.Flags().GetBool("sb")
		getNetworkInterfaces, _ := cmd.Flags().GetBool("ni")
		getNetworkStats, _ := cmd.Flags().GetBool("ns")

		if getNetworkTotalErrors {
			errors, err := GetNetworkTotalErrors()
			if err == nil {
				println("Total Network Errors:", errors)
			}
		}
		if getNetworkPacketsDropped {
			dropped, err := GetNetworkPacketsDropped()
			if err == nil {
				println("Total Packets Dropped:", dropped)
			}
		}
		if getNetworkInterfaceStats {
			ifaces, err := GetNetworkInterfaces()
			if err == nil {
				for _, iface := range ifaces {
					println("Interface:", iface.Name)
				}
			}
		}
		if getNetworkErrorStats {
			stats, err := GetNetworkErrorStats()
			if err == nil {
				for _, s := range stats {
					println("Error Interface:", s.Name)
				}
			}
		}
		if getNetworkPacketsReceived {
			pr, err := GetNetworkPacketsReceived()
			if err == nil {
				println("Packets Received:", pr)
			}
		}
		if getNetworkPacketsSent {
			ps, err := GetNetworkPacketsSent()
			if err == nil {
				println("Packets Sent:", ps)
			}
		}
		if getNetworkReceivedBytes {
			rb, err := GetNetworkReceivedBytes()
			if err == nil {
				println("Bytes Received:", rb)
			}
		}
		if getNetworkSentBytes {
			sb, err := GetNetworkSentBytes()
			if err == nil {
				println("Bytes Sent:", sb)
			}
		}
		if getNetworkInterfaces {
			ifaces, err := GetNetworkInterfaces()
			if err == nil {
				for _, iface := range ifaces {
					println("Interface:", iface.Name)
				}
			}
		}
		if getNetworkStats {
			stats, err := GetNetworkStats()
			if err == nil {
				for _, s := range stats {
					println("Interface:", s.Name, "Bytes Sent:", s.BytesSent, "Bytes Recv:", s.BytesRecv)
				}
			}
		}
	},
}
View Source
var PwdCmd = &cobra.Command{
	Use:   "pwd",
	Short: "Print the current working directory",
	Run: func(cmd *cobra.Command, args []string) {
		dir, err := os.Getwd()
		checkError(err, "getting current working directory")
		fmt.Println(dir)
	},
}
View Source
var RmCmd = &cobra.Command{
	Use:   "rm",
	Short: "Remove files or directories",
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) < 1 {
			fmt.Println("Usage: rm [flags] [file ...]")
			return
		}
		interactive, _ := cmd.Flags().GetBool("interactive")
		confirmAll, _ := cmd.Flags().GetBool("confirm-all")
		recursive, _ := cmd.Flags().GetBool("recursive")
		force, _ := cmd.Flags().GetBool("force")

		if interactive {
			for _, file := range args {
				RemoveI_Method(file)
			}
		} else if confirmAll {
			fmt.Print("Remove all specified files? (y/n): ")
			reader := bufio.NewReader(os.Stdin)
			char, _, err := reader.ReadRune()
			if err != nil {
				fmt.Println("Error reading input:", err)
				return
			}
			if char == 'Y' || char == 'y' {
				for _, file := range args {
					removeFile(file)
				}
			} else {
				fmt.Println("Files not removed")
			}
		} else if recursive {
			if len(args) != 1 {
				fmt.Println("Usage: rm -r [directory]")
				return
			}
			removeDir(args[0])
		} else if force {
			for _, file := range args {
				removeFile(file)
			}
		} else {
			for _, file := range args {
				removeFile(file)
			}
		}
	},
}
View Source
var TailCmd = &cobra.Command{
	Use:   "tail [file]",
	Short: "Display the last 10 lines of a file",
	Args:  cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		file, err := os.Open(args[0])
		checkError(err, "opening file")
		defer file.Close()

		lines, err := io.ReadAll(file)
		checkError(err, "reading file")
		allLines := strings.Split(string(lines), "\n")
		start := len(allLines) - 10
		if start < 0 {
			start = 0
		}
		for _, line := range allLines[start:] {
			fmt.Println(line)
		}
	},
}
View Source
var TouchCmd = &cobra.Command{
	Use:   "touch [filename]",
	Short: "Create a new file",
	Long:  `The touch command creates a new file with the given filename.`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 1 {
			File_Maker(args[0])
		} else if len(args) > 1 {
			for _, i := range args[:] {
				File_Maker(i)
			}
		}
	},
}

Functions

func ClearRegistry

func ClearRegistry()

func Dir_Maker

func Dir_Maker(dir_Name string)

func File_Maker

func File_Maker(fileName string)

func GetAvailableCommands

func GetAvailableCommands() []string

func GetCPUCount

func GetCPUCount() (int, error)

func GetCPUFrequency

func GetCPUFrequency() ([]cpu.InfoStat, error)

func GetCPUIdle

func GetCPUIdle() (float64, error)

func GetCPUNice

func GetCPUNice() (float64, error)

func GetCPUPercentages

func GetCPUPercentages(interval float64) ([]float64, error)

func GetCPUStealTime

func GetCPUStealTime() (float64, error)

func GetCPUSystemTime

func GetCPUSystemTime() (float64, error)

func GetCPUTemperature

func GetCPUTemperature() float64

func GetCPUUsage

func GetCPUUsage() (float64, error)

func GetCPUUserTime

func GetCPUUserTime() (float64, error)

func GetClocksPerSecond

func GetClocksPerSecond() uint64

func GetCommand

func GetCommand(name string) *cobra.Command

func GetCommandCount

func GetCommandCount() int

func GetDiskFree

func GetDiskFree() (uint64, error)

func GetDiskIOStats

func GetDiskIOStats() (map[string]disk.IOCountersStat, error)

func GetDiskInodeUsage

func GetDiskInodeUsage() (uint64, uint64, error)

func GetDiskInodes

func GetDiskInodes() (uint64, uint64, error)

func GetDiskInodesFree

func GetDiskInodesFree() (uint64, error)

func GetDiskInodesUsed

func GetDiskInodesUsed() (uint64, error)

func GetDiskReadBytes

func GetDiskReadBytes() (uint64, error)

func GetDiskReadBytesPerSecond

func GetDiskReadBytesPerSecond() (uint64, error)

func GetDiskReadWriteStats

func GetDiskReadWriteStats() (map[string]disk.IOCountersStat, error)

func GetDiskSerialNumber

func GetDiskSerialNumber() (string, error)

func GetDiskTotal

func GetDiskTotal() (uint64, error)

func GetDiskTotalInodes

func GetDiskTotalInodes() (uint64, error)

func GetDiskTotalUsed

func GetDiskTotalUsed() (uint64, error)

func GetDiskUsage

func GetDiskUsage() (float64, uint64, error)

func GetDiskUsageByPath

func GetDiskUsageByPath(path string) (float64, uint64, error)

func GetDiskWriteBytes

func GetDiskWriteBytes() (uint64, error)

func GetDiskWriteBytesPerSecond

func GetDiskWriteBytesPerSecond() (uint64, error)

func GetMemoryAvailable

func GetMemoryAvailable() (uint64, error)

func GetMemoryBuffers

func GetMemoryBuffers() (uint64, error)

func GetMemoryCached

func GetMemoryCached() (uint64, error)

func GetMemoryFree

func GetMemoryFree() (uint64, error)

func GetMemorySwapFree

func GetMemorySwapFree() (uint64, error)

func GetMemorySwapTotal

func GetMemorySwapTotal() (uint64, error)

func GetMemorySwapUsed

func GetMemorySwapUsed() (uint64, error)

func GetMemoryTotal

func GetMemoryTotal() (uint64, error)

func GetMemoryTotalSwap

func GetMemoryTotalSwap() (uint64, error)

func GetMemoryTotalUsed

func GetMemoryTotalUsed() (uint64, error)

func GetMemoryUsage

func GetMemoryUsage() (float64, uint64, error)

func GetNetworkErrorStats

func GetNetworkErrorStats() ([]net.IOCountersStat, error)

func GetNetworkInterfaceStats

func GetNetworkInterfaceStats(name string) (*net.InterfaceStat, error)

func GetNetworkInterfaces

func GetNetworkInterfaces() ([]net.InterfaceStat, error)

func GetNetworkPacketsDropped

func GetNetworkPacketsDropped() (uint64, error)

func GetNetworkPacketsReceived

func GetNetworkPacketsReceived() (uint64, error)

func GetNetworkPacketsSent

func GetNetworkPacketsSent() (uint64, error)

func GetNetworkReceivedBytes

func GetNetworkReceivedBytes() (uint64, error)

func GetNetworkSentBytes

func GetNetworkSentBytes() (uint64, error)

func GetNetworkStats

func GetNetworkStats() ([]net.IOCountersStat, error)

func GetNetworkTotalErrors

func GetNetworkTotalErrors() (uint64, error)

func GetRegisteredCommands

func GetRegisteredCommands() []string

func GetSwapFree

func GetSwapFree() (uint64, error)

func GetSwapTotal

func GetSwapTotal() (uint64, error)

func GetSwapUsed

func GetSwapUsed() (uint64, error)

func HistoryFilePath

func HistoryFilePath() string

func InitCommands

func InitCommands(rootCmd *cobra.Command)

func InitializeCommands

func InitializeCommands()

func IsCommandRegistered

func IsCommandRegistered(name string) bool

func RegisterCommand

func RegisterCommand(cmd *cobra.Command)

func RemoveI_Method

func RemoveI_Method(file string)

func UnregisterCommand

func UnregisterCommand(name string)

func ValidateCommands

func ValidateCommands() []string

Types

type Command

type Command struct {
	Name       string
	Args       []string
	InputFile  string
	OutputFile string
	AppendFile string
	ErrorFile  string
}

type CommandChain

type CommandChain struct {
	Commands  []Command
	Operators []string
}

func ParseInput

func ParseInput(input string) (*CommandChain, error)

type Executor

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

func NewExecutor

func NewExecutor() *Executor

func (*Executor) ExecuteChain

func (e *Executor) ExecuteChain(chain *CommandChain) error

func (*Executor) GetLastExitCode

func (e *Executor) GetLastExitCode() int

func (*Executor) SetHistoryManager

func (e *Executor) SetHistoryManager(hm *HistoryManager)

type FileInfoStruct

type FileInfoStruct struct {
	Fname  string
	Ftime  time.Time
	Fsize  int64
	Fgroup string
}

type HistoryManager

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

func NewHistoryManager

func NewHistoryManager() (*HistoryManager, error)

func (*HistoryManager) Add

func (hm *HistoryManager) Add(command string)

func (*HistoryManager) Close

func (hm *HistoryManager) Close() error

func (*HistoryManager) Flush

func (hm *HistoryManager) Flush() error

func (*HistoryManager) GetHistory

func (hm *HistoryManager) GetHistory() []string

func (*HistoryManager) GetHistoryItem

func (hm *HistoryManager) GetHistoryItem(index int) (string, error)

func (*HistoryManager) PrintHistory

func (hm *HistoryManager) PrintHistory(args []string)

func (*HistoryManager) SearchHistory

func (hm *HistoryManager) SearchHistory(pattern string) []string

Jump to

Keyboard shortcuts

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