Code Monkey home page Code Monkey logo

vbspretty's Introduction

vbspretty GitHub license npm version

A sophisticated VBScript parser and beautifier powered by nodejs.

Usage

npm i vbspretty

As command-line (See command line options at CLI)

npx vbspretty ./MyApp.vbs

Nodejs usage

const fs = require('fs');
const vbspretty = require('vbspretty');

const source = fs.readFileSync('./MyApp.vbs').toString();

var sourcePretty = vbspretty({
  level: 0,
  indentChar: '\t',
  breakLineChar: '\r\n',
  breakOnSeperator: false,
  removeComments: false,
  source: source,
});

fs.writeFileSync('./MyAppPretty.vbs', sourcePretty);

CLI usage

Cli accepts all options from the api plus an --output option to provide a different file to output formatted version, if --output is omitted, the input file will be overwritten.

First param should always be the input file and it's mandatory, other params are optionals to configure vbspretty options. See full example bellow.

vbspretty MyApp.vbs --level 0 --indentChar "\t" --breakLineChar "\r\n" --breakOnSeperator --removeComments --output ./MyAppPretty.vbs

API

Options Type Default Description
level number 0 Indent level to start off
indentChar String "spacespace" Indent character (e.g., \t, spacespace)
breakLineChar String "\n" Break line character (e.g., \n, \r\n)
breakOnSeperator boolean false Whether it breaks the line on occurrences of the ":" statement separator.
removeComments boolean false Whether it removes comments from the input.

vbspretty's People

Contributors

lenilsondc avatar

Stargazers

 avatar Lukas Neubert avatar  avatar Albert Song avatar

Watchers

James Cloos avatar Aonghus O Nia avatar  avatar

Forkers

codecubers

vbspretty's Issues

indentChar in command line not accepting spaces

Platform: Windows 10
Terminal: bash

When the script invoked from command line, the indentChar is working as expected for a tab "\t". However, when spaces given is various approaches not accepted. Please see 3 expamples below. It is working fine when calling from Javascript though.

$ npx vbspretty ./index-unpretty.vbs --level 0 --indentChar "  " --output ./index-pretty-cls-spaced.vbs
Option 'indentChar' accepts tabs or spaces, got '--output' instead

$ npx vbspretty ./index-unpretty.vbs --level 0 --indentChar "spacespace" --output ./index-pretty-cls-spaced.vbs
Option 'indentChar' accepts tabs or spaces, got 'spacespace' instead

$ npx vbspretty ./index-unpretty.vbs --level 0 --indentChar "\s\s" --output ./index-pretty-cls-spaced.vbs
Option 'indentChar' accepts tabs or spaces, got '\s\s' instead

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.