findexec

package module
v0.0.0-...-78db24c Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2019 License: Unlicense Imports: 4 Imported by: 15

README

findexec

travisci codecov Go Report Card GoDoc

A go library to find paths of executables

Usage

package main

import "github.com/jonhadfield/findexec"

func main() {
    // find an executable called "diff" without specifying paths which will force
    // searching of the system paths found in environment variable 'PATH'
    _ = findexec.Find("diff", "")
    
    // find an executable called "bash" in specific paths
    _ = findexec.Find("bash", "/home/bin:/bin:/usr/local/bin")
}

License

The source code is made available under the terms of the Unlicense License, as stated in the file LICENSE.

Credits

This is rewrite of the find_executable() function provided in the python 2 standard library.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(executable, path string) string

Find searches for an executable in the directories list in 'path'. If a path is not supplied, it defaults to those available in the OS' 'PATH' environment variable. It returns the complete path to the filename if found, otherwise it returns an empty string

Types

This section is empty.

Jump to

Keyboard shortcuts

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