Skip to content

Commit

Permalink
Merge pull request #41537 from Ishad-M-I-M/patch-1
Browse files Browse the repository at this point in the history
Correct the help text of `bal format` command
  • Loading branch information
keizer619 authored Nov 2, 2023
2 parents 08d337c + 916ba70 commit 39298db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions misc/formatter/modules/formatter-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ according to the default [Ballerina style guide](https://github.com/ballerina-pl
The Ballerina format command can be used to format Ballerina source files.

```sh
$ ballerina format --help
$ bal format --help
Prints the help guide for the Ballerina format tool.

Usage:
ballerina format [<ballerinaFile> | <moduleName>] [-d | --dry-run]
bal format [<ballerinaFile> | <moduleName>] [-d | --dry-run]
ballerinaFile:
Path of a single Ballerina source file, which needs to be formatted.
moduleName:
Expand All @@ -29,26 +29,26 @@ Flags:

**Example 1:** Formats all the Ballerina source files in a Ballerina project.
```sh
$ ballerina format
$ bal format
```

This command should be executed from the root of the Ballerina project.

**Example 2:** Formats all the Ballerina source files in a Ballerina module.
```sh
$ ballerina format module1
$ bal format module1
```
This command should be executed from the root of the Ballerina project.

**Example 3:** Formats a single Ballerina source file.
```sh
$ ballerina format hello.bal
$ bal format hello.bal
```

**Example 4:** Performs a dry run of the formatter to see which files will be formatted
if executed.
```sh
$ ballerina format -d
$ ballerina format module1 -d
$ ballerina format hello.bal -d
$ bal format -d
$ bal format module1 -d
$ bal format hello.bal -d
```
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public class Messages {
private static final String ARGUMENT_ERROR = "too many arguments." + System.lineSeparator()
+ "usage: only one argument, either a ballerina file name or a module "
+ "name, can be applied at a time with or without the option." + System.lineSeparator()
+ "i.e: ballerina format [ballerinaFile | ModuleName] [-d | --dry-run]" + System.lineSeparator()
+ System.lineSeparator() + "run `ballerina format -h` for more details.";
+ "i.e: bal format [ballerinaFile | ModuleName] [-d | --dry-run]" + System.lineSeparator()
+ System.lineSeparator() + "run `bal format -h` for more details.";

private static final String SUCCESS_MESSAGE = "format successful.";

private static final String NOT_BALLERINA_PROJECT = "not a valid Ballerina project." + System.lineSeparator()
+ "usage: ballerina format should be run inside a ballerina project or pass in a ballerina file."
+ System.lineSeparator() + "i.e. `ballerina format <ballerina-file>`"
+ System.lineSeparator() + System.lineSeparator() + "run `ballerina format -h` for more details";
+ "usage: bal format should be run inside a ballerina project or pass in a ballerina file."
+ System.lineSeparator() + "i.e. `bal format <ballerina-file>`"
+ System.lineSeparator() + System.lineSeparator() + "run `bal format -h` for more details";

private static final String NO_MODULE_FOUND = "couldn't find an existing module by the name: ";

Expand All @@ -42,7 +42,7 @@ public class Messages {

private static final String NOT_BALLERINA_FILE = "not a valid ballerina source file." + System.lineSeparator()
+ "usage: ballerina source files should have the file extension as `.bal`." + System.lineSeparator()
+ "i.e. `ballerina format hello.bal`";
+ "i.e. `bal format hello.bal`";

private static final String NO_BALLERINA_FILE_OR_MODULE = "couldn't find an existing ballerina file or " +
"module by the name: ";
Expand Down

0 comments on commit 39298db

Please sign in to comment.