Commit 8527b713 authored by Avi's avatar Avi

Cleaned up gio-head.js wih ESLint and removing extra lines

parent 5919962a
......@@ -21,12 +21,7 @@ const head = async(filename)=>{
let content_formatted;
try {
let [, raw_content] = await load_contents_promise(null, file);
/* Prints 'true' as load was successful */
// content_formatted = raw_content[0].toString();
/* Get only the results with raw_content[1] instead of printing all of the values */
content_formatted = raw_content.toString();
/* Prints '1527301825:698952' for the location of the contents */
// content_formatted = raw_content[2].toString();
print(content_formatted.split('\n', 10).join('\n'));
} catch (error) {
logError(error);
......@@ -41,40 +36,4 @@ if (ARGV.length !== 1) {
head(ARGV[0]);
cancel.cancel();
loop.run();
}
/* ES6 - This works! */
// const head=async(filename)=>{
// let file = Gio.file_new_for_commandline_arg(filename);
// file.load_contents_async(null, function(f, res) {
// let raw_content;
// let content_formatted;
// try {
// raw_content = f.load_contents_finish(res)[1];
// content_formatted = raw_content.toString();
// print(content_formatted.split('\n', 10).join('\n'));
// } catch (error) {
// logError(error);
// } finally {
// loop.quit();
// }
// });
// }
/* Original - This works! */
// function head(filename) {
// let file = Gio.file_new_for_commandline_arg(filename);
// file.load_contents_async(null, function(f, res) {
// let raw_content;
// let content_formatted;
// try {
// raw_content = f.load_contents_finish(res)[1];
// content_formatted = raw_content.toString();
// print(content_formatted.split('\n', 10).join('\n'));
// } catch (error) {
// logError(error);
// } finally {
// loop.quit();
// }
// });
// }
\ No newline at end of file
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment