Skip to content

Latest commit

 

History

History
106 lines (76 loc) · 3.71 KB

README.md

File metadata and controls

106 lines (76 loc) · 3.71 KB

LVbag

Generate embedded file lists for directories. LVbag can serve as an occasional helper with static directories or become a part of the build process to assist in embedding dynamic files

Usage: lvb [flags] [commands] <path>

A large and handy file bag for V. It simplifies carrying files with your programs
by generating embed file lists for directories based on your specifications.

Flags:
  -o    --output       The output file name. If none is set, the result is printed to stdout.
  -a    --append       Append the result to the output file.
  -f    --force        Overwrite the output file if it already exists.
  -I    --ignore       Ignore the paths in the target directories if they contain these strings.
  -r    --regex        Treat the ignore string as a regex pattern.
  -h    --hidden       Include hidden files.
  -bag  --lv_bag       The name of the handbag variable [default: `lv_bag`].
  -mod  --mod_name     Specify the module name used in the output.
  -v    --verbose      Enable extended information prints.
        --skip-format  Skip formatting of the output file.
        --help         Prints help information.
        --version      Prints version information.

Commands:
  help                 Prints help information.
  version              Prints version information.

Installation

Usage Examples

  • Add a path without additional flags to print the output to the terminal.

    lvb examples/gui_project/ui
    const lv_bag = [
    	$embed_file('/home/t/Dev/vlang/lvb/examples/gui_project/ui/src/main.js')
    	$embed_file('/home/t/Dev/vlang/lvb/examples/gui_project/ui/src/style.css')
    	$embed_file('/home/t/Dev/vlang/lvb/examples/gui_project/ui/src/index.html')
    ]
  • Append to an existing file, specify a "bag" name (specifying a single file as path won't create an array).

    # Append to an existing file `foo.v`
    lvb -bag icon -o foo.v -a assets/icon.ico
    // foo.v
    module main
    
    const foo = "foo"
    
    const icon = $embed_file('<path>/ui_project/assets/icon.ico')
  • Add a module name to the output, make the output print verbose.

    lvb -mod bar -v examples/ui_project/ui

    lvb

App examples

Simple Application examples that utilize this tool can be found in the .examples/ directory.

An example application that uses LVbag to embed the files of a dynamic npm build output is emoji-mart-desktop

Development

To compile the app yourself, clone the repository and build the release version.

# Clone the repository
git clone https://github.com/ttytm/LVbag.git
cd LVbag

# Install dependencies - LVB uses PCRE
v install --once

# Build and run as usual in development
v run .

# Build the release version
v -cc gcc -prod -o lvb .