github.com/soypat/rebed@v0.2.3/README.md (about)

     1  # rebed
     2  [![codecov](https://codecov.io/gh/soypat/rebed/branch/main/graph/badge.svg)](https://codecov.io/gh/soypat/rebed)
     3  [![Build Status](https://travis-ci.org/soypat/rebed.svg?branch=main)](https://travis-ci.org/soypat/rebed)
     4  [![Go Report Card](https://goreportcard.com/badge/github.com/soypat/rebed)](https://goreportcard.com/report/github.com/soypat/rebed)
     5  [![go.dev reference](https://pkg.go.dev/badge/github.com/soypat/rebed)](https://pkg.go.dev/github.com/soypat/rebed)
     6  [![Awesome](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go/blob/master/README.md#resource-embedding)
     7  [![Sourcegraph](https://sourcegraph.com/github.com/soypat/rebed/-/badge.svg)](https://sourcegraph.com/github.com/soypat/rebed?badge)
     8  
     9  Recreate embedded filesystems from embed.FS type in current working directory. 
    10  
    11  Expose the files you've embedded in your binary so users can see and/or tinker with them. See [where is this useful](#where-is-this-useful) for an application example.
    12  
    13  Install with (requires Go 1.16+)
    14  
    15  ```shell-script
    16  go get -u github.com/soypat/rebed
    17  ```
    18  
    19  ## Five actions available:
    20  
    21  ```go
    22  
    23  //go:embed someFS/*
    24  var bdFS embed.FS
    25  
    26  // Just replicate folder Structure
    27  rebed.Tree(bdFS, "")
    28  
    29  // Make empty files
    30  rebed.Touch(bdFS, "")
    31  
    32  // Recreate entire FS
    33  rebed.Write(bdFS, "")
    34  
    35  // Recreate FS without modifying existing files
    36  rebed.Patch(bdFS, "")
    37  
    38  // Runs Patch if no conflicting file is found, else error.
    39  err := rebed.Create(bdFS, "")
    40  
    41  /* Walk allows you operate on each file as you wish */
    42  ```
    43  
    44  ### Where is this useful?
    45  You could theoretically embed your web development assets folder and deploy it. The binary could run from the working directory folder generated by `rebed` and users could modify the assets and change the website's look (to do this run `rebed.Patch` to not overwrite modified files). If asset files are lost or the site breaks, running `rebed.Write` replaces all files with original ones.
    46  
    47  ## Contributing
    48  I'll look at issues and pull requests. Add a clear explanation when doing so!