All Projects → aseure → Pop

aseure / Pop

Licence: mit
🌽 Generate directories and files in Go as quickly as making pop corn 🌽

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Pop

Filemasta
A search application to explore, discover and share online files
Stars: ✭ 571 (+2382.61%)
Mutual labels:  files
Memacs
What did I do on February 14th 2007? Visualize your (digital) life in Org-mode
Stars: ✭ 711 (+2991.3%)
Mutual labels:  files
Alchemy
🔮 File conversion, all from the menu bar
Stars: ✭ 815 (+3443.48%)
Mutual labels:  files
Filegator
Powerful Multi-User File Manager
Stars: ✭ 587 (+2452.17%)
Mutual labels:  files
Arkit
JavaScript architecture diagrams and dependency graphs
Stars: ✭ 671 (+2817.39%)
Mutual labels:  generate
Libaums
Open source library to access USB Mass Storage devices on Android without rooting your device
Stars: ✭ 769 (+3243.48%)
Mutual labels:  files
React Uploady
Modern file uploading - components & hooks for React
Stars: ✭ 372 (+1517.39%)
Mutual labels:  files
Laravel Bootstrap Table List
Bootstrap table list generator for Laravel.
Stars: ✭ 16 (-30.43%)
Mutual labels:  generate
Uppy
The next open source file uploader for web browsers 🐶
Stars: ✭ 24,829 (+107852.17%)
Mutual labels:  files
Raw Loader
A loader for webpack that allows importing files as a String
Stars: ✭ 800 (+3378.26%)
Mutual labels:  files
Laravel Menu
Html menu generator for Laravel
Stars: ✭ 650 (+2726.09%)
Mutual labels:  generate
Open Shell Book
开源书籍:《Shell 编程范例》,面向操作对象学 Shell!本书作者发布了《360°剖析 Linux ELF》视频课程,欢迎订阅:https://www.cctalk.com/m/group/88089283
Stars: ✭ 666 (+2795.65%)
Mutual labels:  files
Crawler
A high performance web crawler in Elixir.
Stars: ✭ 781 (+3295.65%)
Mutual labels:  files
Fileb0x
a better customizable tool to embed files in go; also update embedded files remotely without restarting the server
Stars: ✭ 583 (+2434.78%)
Mutual labels:  files
Numgen
Creates objects that generate number sequences
Stars: ✭ 5 (-78.26%)
Mutual labels:  generate
Pomf
Simple file uploading and sharing
Stars: ✭ 535 (+2226.09%)
Mutual labels:  files
Iconizer
Create Xcode asset catalogs swift and painless. Generate images for macOS and iOS app icons, launch images and image sets.
Stars: ✭ 751 (+3165.22%)
Mutual labels:  generate
Tagstore
a research software; a fun way of storing files & folders on your local disk drive; tagging
Stars: ✭ 18 (-21.74%)
Mutual labels:  files
Aetherupload Laravel
A Laravel package to upload large files 上传大文件的Laravel扩展包
Stars: ✭ 835 (+3530.43%)
Mutual labels:  files
Swiftkit
Start your next Open-Source Swift Framework 📦
Stars: ✭ 785 (+3313.04%)
Mutual labels:  generate

pop.Corn

Build Status

Go standard library makes file manipulation very easy. However, it's a little cumbersome to generate a whole file architecture easily. This pop Go package is here to help! Simply describe your tree with a few pop.Corn, call pop.Generate or pop.GenerateFromRoot on it and all the intermediate directories and dummy files will be ready in no time! Populating a directory for integration testing has never been so fast and fun.

pop

What's included?

Only one structure and two functions are exported.

The pop.Corn structure is actually a map[string]interface{} holding all your files and directories, because a 14-character difference is a lot.

The pop.Generate generates the given files and directories in a new directory. Its path is returned as long as an error which may be non-nil if anything went wrong during the generation.

The pop.GenerateFromRoot does the same as pop.Generate but will produce the resulting files and directories within the providided directory path. It also returns a non-nil error if anything went wrong during the generation. If the root directory already exists, it will be deleted first.

Example

In the following example, we are generating a tree of files under the automatically generated root directory. It contains:

  • a README.md file
  • a json/ directory with two JSON files in it
  • an empty vendor/ directory
  • a src/ directory with two C++ files in it and an empty file
  • a test/ directory with an empty file in it
files := pop.Corn{
    "README.md": "# This is the title",
    "json/": pop.Corn{
        "test1.json": bytes.NewBufferString(`{"key1":"value1","key2":"value2"}`),
        "test2.json": `{"key3":"value3","key4":"value4"}`,
    },
    "vendor/": nil,
    "src/": pop.Corn{
        "one.cc":    "int main() {}",
        "two.cc":    "#include <iostream>",
        "empty.txt": nil,
    },
    "test/": pop.Corn{
        ".gitkeep": nil,
    },
}

root, err := pop.Generate(files)

All directory names must end with a slash and can either be nil or contain a new pop.Corn instance.

Files are represented by non-slash-terminating string names and their content as a string or an io.Reader. If the content is nil or an empty string, the generated file will be empty.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].