Fix bug where you weren't able to use both the -q and -j flags at the same time #227

Open
Vylpes wants to merge 11 commits from feature/181-q-json-flags into develop
2 changed files with 5 additions and 7 deletions
Showing only changes of commit 67e6c16028 - Show all commits

View file

@ -22,13 +22,13 @@ export default class OutputHelper {
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
private static GetFriendlyObjectText(object: any): string { private static GetFriendlyObjectText(object: any): string {
let output = ""; const output: string[] = [];
Review

I don't think I like the way this is done, I think it should be how it was before, but when its actually printed to the terminal it should remove the appended new line

I don't think I like the way this is done, I think it should be how it was before, but when its actually printed to the terminal it should remove the appended new line
for (const key in object) { for (const key in object) {
output += `${key} = ${object[key]}\n`; output.push(`${key} = ${object[key]}`);
} }
return output; return output.join("\n");
} }
/* eslint-enable @typescript-eslint/no-explicit-any */ /* eslint-enable @typescript-eslint/no-explicit-any */
} }

View file

@ -10,8 +10,7 @@ Subreddit = Rabbits
SubredditSubscribers = 654751 SubredditSubscribers = 654751
Title = This is my Ms Bear! Title = This is my Ms Bear!
Ups = 17 Ups = 17
Url = https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d Url = https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d"
"
`; `;
exports[`GenerateOutput GIVEN options.json is true, EXPECT output to be returned as JSON 1`] = `"{"Archived":false,"Author":"author","Downs":0,"Hidden":false,"Permalink":"/r/Rabbits/comments/1dj8pbt/this_is_my_ms_bear/","Subreddit":"Rabbits","SubredditSubscribers":654751,"Title":"This is my Ms Bear!","Ups":17,"Url":"https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d"}"`; exports[`GenerateOutput GIVEN options.json is true, EXPECT output to be returned as JSON 1`] = `"{"Archived":false,"Author":"author","Downs":0,"Hidden":false,"Permalink":"/r/Rabbits/comments/1dj8pbt/this_is_my_ms_bear/","Subreddit":"Rabbits","SubredditSubscribers":654751,"Title":"This is my Ms Bear!","Ups":17,"Url":"https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d"}"`;
@ -31,6 +30,5 @@ Ups = 17
Url = https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d Url = https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d
subreddit = rabbits subreddit = rabbits
sortBy = hot sortBy = hot
limit = 100 limit = 100"
"
`; `;