Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-cross

A go cross platform library with abstractions for standard lib global functions.

using

go get github.com/patrickhuber/go-cross

target

import(
  "github.com/patrickhuber/go-cross"
)
func main(){
  t := cross.New()
  fmt.Println(t.Console().Executable())
}

os

import(
  "github.com/patrickhuber/go-cross/os"
)
func main(){
  o := os.New()
  wd, err := o.WorkingDirectory()
  if err != nil{
    fmt.Errorf("%w", err)
  }
  fmt.Println(wd)
}

env

import(
  "github.com/patrickhuber/go-cross/env"
)
func main(){
  e := env.New()
  e.Set("MY_ENV_VAR", "test")
  fmt.Println(e.Get("MY_ENV_VAR"))
}
test

console

import(
  "github.com/patrickhuber/go-cross/console"
)  
func main(){
  c := console.New()
  fmt.Fprintln(c.Out(), "hello world")
}
hello world

filepath

import(
  "github.com/patrickhuber/go-cross/filepath"
) 

func main(){
  // creates the default platform parser
  parser := filepath.NewParser()
  fp, err := parser.Parse("/some/path/to/parse")
  if err != nil{
    fmt.Fprintf("%w", err)
    os.Exit(1)
  }
  for _, seg := range fp.Segments{
    fmt.Println(seg)
  }
}
some
path
to
parse

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages