Skip to content

Commit

Permalink
[cpp] -v now prints a good amount of information
Browse files Browse the repository at this point in the history
  • Loading branch information
harrand committed May 5, 2024
1 parent 5d8d720 commit f80a7e4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
working-directory: cpp

- name: 'Compile a simple test program'
run: ./cpp/build/ci_${{inputs.build_config}}/psyc ./samples/minimal.psy
run: ./cpp/build/ci_${{inputs.build_config}}/psyc -v ./samples/minimal.psy

2 changes: 1 addition & 1 deletion .github/workflows/build_gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
working-directory: cpp

- name: 'Compile a simple test program'
run: ./cpp/build/ci_${{inputs.build_config}}/psyc ./samples/minimal.psy
run: ./cpp/build/ci_${{inputs.build_config}}/psyc -v ./samples/minimal.psy

16 changes: 15 additions & 1 deletion cpp/src/psyc_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct timers
void print()
{
constexpr int width = 12;
std::cout << std::right;
std::cout << std::setw(width) << "lexer:" << std::setw(6) << std::setprecision(3) << (this->lexing / 1000.0f) << " seconds" << std::endl;
std::cout << std::setw(width) << "parser:" << std::setw(6) << std::setprecision(3) << (this->parsing / 1000.0f) << " seconds" << std::endl;
std::cout << std::setw(width) << "buildmeta:" << std::setw(6) << std::setprecision(3) << (this->buildmeta / 1000.0f) << " seconds" << std::endl;
Expand Down Expand Up @@ -138,5 +139,18 @@ config::compiler_args parse_args(std::span<const std::string_view> args)

void print_version_info()
{
diag::nyi("-v");
std::cout << "OVERVIEW: Psy Compiler\n\n";
std::cout << "USAGE: psyc [options] files...\n\n";
std::cout << "OPTIONS:\n";
constexpr int width = 22;
constexpr int width2 = 42;
std::cout << std::setw(width) << std::left << "-v" << std::setw(width2) << "display version info and help." << std::endl;
std::cout << std::setw(width) << std::left << "-o [dir]" << std::setw(width2) << "designates an output directory." << std::endl;
std::cout << std::setw(width) << std::left << "-t [target-name]" << std::setw(width2) << "tell the compiler to find a build meta-region of the given name to treat as build instructions." << std::endl;
std::cout << std::setw(width) << std::left << "-l [linker-name]" << std::setw(width2) << "specifies which linker to use." << std::endl;

std::cout << "\nFILES:\n";
std::cout << "- Must be absolute or relative paths (with respect to current working directory).\n";
std::cout << "- Contain valid psy source code.\n";
std::cout << "\n";
}

0 comments on commit f80a7e4

Please sign in to comment.