Skip to content

scratch-fuse/formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fuse-formatter

A command-line formatter for FUSE language source code.

Installation

npm install -g fuse-formatter

Or install locally in your project:

npm install fuse-formatter

Usage

Command Line

fuse-formatter [options] <input>

Arguments

  • input - Input file to format (use - to read from stdin)

Options

  • -o, --output <file> - Output destination (use - for stdout, default: stdout)
  • -i, --indent <number> - Number of spaces for indentation (default: 2)
  • -s, --semi - Require semicolons
  • -h, --help - Show help message

Examples

Format a file and output to stdout:

fuse-formatter input.fuse

Format with custom indentation (4 spaces):

fuse-formatter input.fuse -i 4

Format with semicolons required:

fuse-formatter input.fuse -s

Format and save to a file:

fuse-formatter input.fuse -o output.fuse

Format from stdin:

cat input.fuse | fuse-formatter -

Combine multiple options:

fuse-formatter input.fuse -i 4 -s -o formatted.fuse

Programmatic Usage

You can also use the formatter programmatically in your Node.js projects:

const { format } = require('fuse-formatter');

const sourceCode = '/* your FUSE code here */';

// Format with default options (indent: 2, semi: false)
const formatted = format(sourceCode);

// Format with custom options
const formattedWithOptions = format(sourceCode, {
  indent: 4,    // Use 4 spaces for indentation
  semi: true    // Require semicolons
});

console.log(formattedWithOptions);

API

format(input, options)

Formats FUSE source code.

Parameters:

  • input (string) - Source code to format
  • options (object) - Optional formatting options
    • indent (number) - Number of spaces for indentation (default: 2)
    • semi (boolean) - Whether to require semicolons (default: false)

Returns: (string) - Formatted source code

License

MPL-2.0

Repository

Author

FurryR

About

Formatter for FUSE language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published