Skip to content

Instantly share code, notes, and snippets.

@quintesse
Created December 11, 2014 15:51
Show Gist options
  • Save quintesse/aeab144d883e0b3b1f65 to your computer and use it in GitHub Desktop.
Save quintesse/aeab144d883e0b3b1f65 to your computer and use it in GitHub Desktop.
@echo off
setlocal EnableDelayedExpansion
set LF=^
REM Two empty lines are necessary
set "USAGE=[OPTION]... ( FILE [--and FILE]... [--to FILE] )..."
set "DESCRIPTION=format Ceylon source code"
set "LONG_USAGE= ceylon run ceylon.formatter source!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE!or, if you’re worried about it breaking your source code (which shouldn’t happen –!LF!"
set "LONG_USAGE=!LONG_USAGE!if anything bad happens, error recovery kicks in and the original file is destroyed)!LF!"
set "LONG_USAGE=!LONG_USAGE!or you just want to test it out:!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE! ceylon run ceylon.formatter source --to source-formatted!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE!You can also format multiple folders at the same time:!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE! ceylon run ceylon.formatter source --and test-source --to formatted!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE!which will recreate the ‘source’ and ‘test-source’ folders inside the new ‘formatted’ folder.!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE!OPTIONS!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE!--help!LF!"
set "LONG_USAGE=!LONG_USAGE! Print this help message.!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE!--version!LF!"
set "LONG_USAGE=!LONG_USAGE! Print version information. The first line is always just the module name and version!LF!"
set "LONG_USAGE=!LONG_USAGE! in the format that ‘ceylon run’ understands (“ceylon.formatter/x.y.z”), which might be!LF!"
set "LONG_USAGE=!LONG_USAGE! useful for scripts.!LF!"
set "LONG_USAGE=!LONG_USAGE!!LF!"
set "LONG_USAGE=!LONG_USAGE!--${option name}=${option value}!LF!"
set "LONG_USAGE=!LONG_USAGE! Set a formatting option. See the documentation of the FormattingOptions class for a list of!LF!"
set "LONG_USAGE=!LONG_USAGE! options. The most useful ones are:!LF!"
set "LONG_USAGE=!LONG_USAGE! !LF!"
set "LONG_USAGE=!LONG_USAGE! --maxLineLength!LF!"
set "LONG_USAGE=!LONG_USAGE! The maximum line length, or “unlimited”.!LF!"
set "LONG_USAGE=!LONG_USAGE! !LF!"
set "LONG_USAGE=!LONG_USAGE! --indentMode!LF!"
set "LONG_USAGE=!LONG_USAGE! The indentation mode. Syntax: “x spaces” or “y-wide tabs” or “mix x-wide tabs, y spaces”.!LF!"
set "LONG_USAGE=!LONG_USAGE! !LF!"
set "LONG_USAGE=!LONG_USAGE! --lineBreak!LF!"
set "LONG_USAGE=!LONG_USAGE! “lf”, “crlf”, or “os” for the operating system’s native line breaks."
call %CEYLON_HOME%\bin\ceylon-sh-setup.bat %*
if "%errorlevel%" == "1" (
exit /b 0
)
%CEYLON% run ceylon.formatter/1.1.0 "%*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment