github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/cmds/exp/pogosh/pogosh.go (about) 1 // Copyright 2020 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "fmt" 9 "os" 10 11 "github.com/u-root/u-root/pkg/pogosh" 12 ) 13 14 func main() { 15 // TODO: not standard 16 file := "/dev/stdin" 17 if len(os.Args) > 1 { 18 file = os.Args[1] 19 } 20 21 state := pogosh.DefaultState() 22 code, err := state.RunFile(file) 23 if err != nil { 24 fmt.Fprintln(os.Stderr, err) 25 } 26 os.Exit(code) 27 }