Implement "embedded" command to extract static resources (#9982)

* draft

* Implement extract command

* Fix nits and force args on extract

* Add !bindata stub, support Windows, fmt

* fix vendored flag

* Remove leading slash for matching

* Add docs

* Fix typos

* Add embedded view command

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
guillep2k 2020-02-01 23:17:44 -03:00 committed by GitHub
parent 9b9dd19d7d
commit bcb52aef09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 568 additions and 6 deletions

View file

@ -229,3 +229,16 @@ func AssetNames() []string {
}
return results
}
func AssetIsDir(name string) (bool, error) {
if f, err := Assets.Open("/" + name); err != nil {
return false, err
} else {
defer f.Close()
if fi, err := f.Stat(); err != nil {
return false, err
} else {
return fi.IsDir(), nil
}
}
}