Skip to content

Commit 448c790

Browse files
poorna2152bmcutler
andauthored
[Bugfix:Autograding] Update number of command args (#4)
* Fix rsync issue * Update num arguments * Fix rsync command * Fix command description Co-authored-by: Barb Cutler <[email protected]>
1 parent 4079b45 commit 448c790

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/diagnostics.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ void diagnose(Parser *parser, const std::vector<std::string> &files) {
5656
}
5757
}
5858
}
59-
std::ofstream output_file("out.json");
60-
output_file << std::setw(4) << file_nodes_obj << std::endl;
59+
std::cout << std::setw(4) << file_nodes_obj << std::endl;
6160
}
6261

6362
int main(int argc, char *argv[]) {

src/utils.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void find_files(const std::string &file_pattern, std::vector<std::string> &files
1919
exit(EXIT_FAILURE);
2020
return;
2121
}
22-
files.insert(files.begin(), glob_result.gl_pathv, glob_result.gl_pathv + glob_result.gl_pathc);
22+
files.insert(files.end(), glob_result.gl_pathv, glob_result.gl_pathv + glob_result.gl_pathc);
2323
globfree(&glob_result);
2424
}
2525

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

5454
void parse_args_counter(int argc, char *argv[], Language &lang, Countable &countable, std::string &feature,
5555
std::vector<std::string> &files) {
56-
std::string usage_format = "Usage: submitty_count_ts -l <language> <countable> <feature> <files>";
57-
if (argc != 6) {
56+
std::string usage_format = "Usage: submitty_count_ts -l <language> <countable> <feature> <files>...";
57+
if (argc < 6) {
5858
std::cerr << "Error: require more arguments" << std::endl;
5959
std::cerr << usage_format << std::endl;
6060
exit(EXIT_FAILURE);
@@ -71,7 +71,7 @@ void parse_args_counter(int argc, char *argv[], Language &lang, Countable &count
7171
} else if (i == 4) {
7272
feature = argv[i];
7373
continue;
74-
} else if (i == 5) {
74+
} else if (i >= 5) {
7575
find_files(argv[i], files);
7676
continue;
7777
}
@@ -82,8 +82,8 @@ void parse_args_counter(int argc, char *argv[], Language &lang, Countable &count
8282
}
8383

8484
void parse_args_diagnoser(int argc, char *argv[], Language &lang, std::vector<std::string> &files) {
85-
std::string usage_format = "Usage: submitty_diagnostics_ts -l <language> <files>";
86-
if (argc != 4) {
85+
std::string usage_format = "Usage: submitty_diagnostics_ts -l <language> <files>...";
86+
if (argc < 4) {
8787
std::cerr << "Error: require more arguments" << std::endl;
8888
std::cerr << usage_format << std::endl;
8989
exit(EXIT_FAILURE);
@@ -94,7 +94,7 @@ void parse_args_diagnoser(int argc, char *argv[], Language &lang, std::vector<st
9494
} else if (i == 2) {
9595
lang = get_language(argv[i]);
9696
continue;
97-
} else if (i == 3) {
97+
} else if (i >= 3) {
9898
find_files(argv[i], files);
9999
continue;
100100
}

0 commit comments

Comments
 (0)