rlpath

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 10 Imported by: 1

README

rlpath.go

rlpath is scanning path with completion library.

rlpath demo

Instalation

$ go get -u github.com/yasukotelin/rlpath
import (
	"github.com/yasukotelin/rlpath"
)

Example

You can use this library so easily!!

package main

import (
	"fmt"
	"log"

	"github.com/yasukotelin/rlpath"
)

func main() {
	scanner := rlpath.Scanner{
		Prompt:  "$ ",
		RootDir: "~/go",
		OnlyDir: false,
	}

	path, err := scanner.Scan()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(path)
}

rlpath.Scanner has options.

Option
Prompt Prompt is left edge text, like a $.
RootDir RootDir is root directory to start scanning. If this is empty, start scanning from execution path.
OnlyDir OnlyDir is flag that shows only directory.

Author

yasukotelin

LICENCE

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

type Scanner struct {
	// Prompt is left edge text, like a $.
	Prompt string
	// RootDir is root directory to start scanning.
	// If this is empty, start scanning from execution path.
	RootDir string
	// OnlyDir is flag that shows only directory.
	OnlyDir bool
}

Scanner can scan standard input with completetion path.

func (*Scanner) Scan

func (sc *Scanner) Scan() (string, error)

Scan scans path from standard input with completion.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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