How Can We Help?

Commands – format

Name

STweep.CLI format – Formats Structured Text.

Description

The format command formats Structured Text according to the given options. The command accepts input folders, files and direct input of Structured Text code.

Usage

STweep.CLI format --settingsfile mysettings.stweep --path <myprojectfolder>  [non required options]

STweep.CLI format --settingsfile mysettings.stweep --code <mycode>  [non required options]

Options

Option Description
 -c | –code Option to input the Structured Text code to format. This option is required if the -p | –path option is not used. STweep CLI attempts to format the Structured Text according to the settings in the  -s | –settingsfile. The given Structured Text should be valid structured Text according to the IEC61131-3. The formatted text is returned in the console.
-p | –path 

Path to files or folders to format. If the path is a folder STweep CLI will recursively search for formattable files. This option is required if  the code option -c | –code is not used. The files are updated with the formatted code. Multiple path can be selected with a semicolon ‘;’ separator or the -p | –path  option multiple times.supported files and extensions:

  • .TcPou – TwinCAT Pou.
  • .TcGVL – TwinCAT Gvl.
  • .TcDut – TwinCAT dut.
  • .xml – PLCopen format.
  • .export – Codesys export files.
-s, –settingsFile  Path to a STweep settings file. The settings files can be exported with the stand alone settings editor which is delivered with STweep CLI or an export from STweep for Codesys or STweep for TwinCAT can be used.
–skipDeclarationCode Optional boolean flag, is used with the -p | –path option. If this option is used STweep CLI will skip the formatting of declaration code.
–skipImplementationCode Optional boolean flag, is used with the -p | –path option. If this option is used STweep CLI will skip the formatting of implementation code.
-e | –exclude

Optional regex filter, is used with the -p | –path option. With the filter specific files or folder can be excluded from formatting. The regex filter is applied on a file or folder path relative from the -p | –path option. Multiple filters can be added with the ‘;’ seperator, or use the -e option several times. The regex ignore cases by default.

Example inputs:

.*TcGvl – To ignore all files which end with TcGvl.

.*TcGvl;.*TcDut – To ignore all files which end with TcGvl or TcDut.

.*myFolder – To ignore the content of any folder called myFolder

.myFolder – To ignore the content the root folder myFolder (root based on the -p | –path option). The content of a child folder ‘myFolder’ might be searched for formatable content.

-v | –verbose boolean flag, output verbose information to the console.
–help Show the help text for the format command.
–version Shows version information.