Skip to content

Commit

Permalink
Add --no-indent flag
Browse files Browse the repository at this point in the history
Indent by default
  • Loading branch information
Shaikh-Ubaid committed May 11, 2023
1 parent a0441aa commit d2420d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion share/lpython/lfortran-completion.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#/usr/bin/env bash

complete \
-W "-h --help -S -c -o -v -E -I --version --cpp --fixed-form --show-prescan --show-tokens --show-ast --show-asr --with-intrinsic-modules --show-ast-f90 --no-color --indent --pass --show-llvm --show-cpp --show-stacktrace --time-report --static --backend --openmp fmt kernel mod pywrap" \
-W "-h --help -S -c -o -v -E -I --version --cpp --fixed-form --show-prescan --show-tokens --show-ast --show-asr --with-intrinsic-modules --show-ast-f90 --no-color --pass --show-llvm --show-cpp --show-stacktrace --time-report --static --backend --openmp fmt kernel mod pywrap" \
-df \
lfortran
4 changes: 3 additions & 1 deletion src/bin/lpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ int main(int argc, char *argv[])
std::string arg_pass;
std::string skip_pass;
bool arg_no_color = false;
bool arg_no_indent = false;
bool show_llvm = false;
bool show_asm = false;
bool show_wat = false;
Expand Down Expand Up @@ -1534,7 +1535,7 @@ int main(int argc, char *argv[])
app.add_flag("--show-stacktrace", compiler_options.show_stacktrace, "Show internal stacktrace on compiler errors");
app.add_flag("--with-intrinsic-mods", with_intrinsic_modules, "Show intrinsic modules in ASR");
app.add_flag("--no-color", arg_no_color, "Turn off colored AST/ASR");
app.add_flag("--indent", compiler_options.indent, "Indented print ASR/AST");
app.add_flag("--no-indent", arg_no_indent, "Turn off Indented print ASR/AST");
app.add_flag("--tree", compiler_options.tree, "Tree structure print ASR/AST");
app.add_flag("--json", compiler_options.json, "Print ASR/AST Json format");
app.add_flag("--visualize", compiler_options.visualize, "Print ASR/AST Visualization");
Expand Down Expand Up @@ -1633,6 +1634,7 @@ int main(int argc, char *argv[])
}

compiler_options.use_colors = !arg_no_color;
compiler_options.indent = !arg_no_indent;

// if (fmt) {
// return format(arg_fmt_file, arg_fmt_inplace, !arg_fmt_no_color,
Expand Down
2 changes: 1 addition & 1 deletion src/libasr/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct CompilerOptions {
bool symtab_only = false;
bool show_stacktrace = false;
bool use_colors = true;
bool indent = false;
bool indent = true;
bool json = false;
bool tree = false;
bool visualize = false;
Expand Down

0 comments on commit d2420d7

Please sign in to comment.