Skip to content

Commit

Permalink
[Bugfix:Autograding] Update number of command args (#4)
Browse files Browse the repository at this point in the history
* Fix rsync issue

* Update num arguments

* Fix rsync command

* Fix command description

Co-authored-by: Barb Cutler <[email protected]>
  • Loading branch information
poorna2152 and bmcutler authored Aug 8, 2022
1 parent 4079b45 commit 448c790
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ void diagnose(Parser *parser, const std::vector<std::string> &files) {
}
}
}
std::ofstream output_file("out.json");
output_file << std::setw(4) << file_nodes_obj << std::endl;
std::cout << std::setw(4) << file_nodes_obj << std::endl;
}

int main(int argc, char *argv[]) {
Expand Down
14 changes: 7 additions & 7 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void find_files(const std::string &file_pattern, std::vector<std::string> &files
exit(EXIT_FAILURE);
return;
}
files.insert(files.begin(), glob_result.gl_pathv, glob_result.gl_pathv + glob_result.gl_pathc);
files.insert(files.end(), glob_result.gl_pathv, glob_result.gl_pathv + glob_result.gl_pathc);
globfree(&glob_result);
}

Expand Down Expand Up @@ -53,8 +53,8 @@ Countable get_countable(const std::string &arg) {

void parse_args_counter(int argc, char *argv[], Language &lang, Countable &countable, std::string &feature,
std::vector<std::string> &files) {
std::string usage_format = "Usage: submitty_count_ts -l <language> <countable> <feature> <files>";
if (argc != 6) {
std::string usage_format = "Usage: submitty_count_ts -l <language> <countable> <feature> <files>...";
if (argc < 6) {
std::cerr << "Error: require more arguments" << std::endl;
std::cerr << usage_format << std::endl;
exit(EXIT_FAILURE);
Expand All @@ -71,7 +71,7 @@ void parse_args_counter(int argc, char *argv[], Language &lang, Countable &count
} else if (i == 4) {
feature = argv[i];
continue;
} else if (i == 5) {
} else if (i >= 5) {
find_files(argv[i], files);
continue;
}
Expand All @@ -82,8 +82,8 @@ void parse_args_counter(int argc, char *argv[], Language &lang, Countable &count
}

void parse_args_diagnoser(int argc, char *argv[], Language &lang, std::vector<std::string> &files) {
std::string usage_format = "Usage: submitty_diagnostics_ts -l <language> <files>";
if (argc != 4) {
std::string usage_format = "Usage: submitty_diagnostics_ts -l <language> <files>...";
if (argc < 4) {
std::cerr << "Error: require more arguments" << std::endl;
std::cerr << usage_format << std::endl;
exit(EXIT_FAILURE);
Expand All @@ -94,7 +94,7 @@ void parse_args_diagnoser(int argc, char *argv[], Language &lang, std::vector<st
} else if (i == 2) {
lang = get_language(argv[i]);
continue;
} else if (i == 3) {
} else if (i >= 3) {
find_files(argv[i], files);
continue;
}
Expand Down

0 comments on commit 448c790

Please sign in to comment.