Skip to content

Splits command strings according to POSIX/Batch semantics

License

Notifications You must be signed in to change notification settings

buildkite/shellwords

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shellwords

A golang library for splitting command-line strings into words like a Posix or Windows shell would.

Installation

go get -u github.com/buildkite/shellwords

Usage

package main

import (
  "github.com/buildkite/shellwords"
  "fmt"
)

func main() {
  words := shellwords.SplitPosix(`/usr/bin/bash -e -c "llamas are the \"best\" && echo 'alpacas'"`)
  for _, word := range words {
    fmt.Println(word)
  }
}

# Outputs:
# /usr/bin/bash
# -e
# -c
# llamas are the "best" && echo 'alpacas'

License

Licensed under MIT license, in LICENSE.

About

Splits command strings according to POSIX/Batch semantics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages