-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add XDG Specification compliance #8
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,12 @@ var fs = require('fs'); | |
var argv = require('minimist')(process.argv.slice(2)); | ||
|
||
var userhome = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']; | ||
var rc_path = userhome+"/.bmndrrc"; | ||
if (process.env.XDG_CONFIG_HOME) { | ||
var rc_path = process.env.XDG_CONFIG_HOME+"/.bmndrrc"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DRY? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like a good approach. How would you implement that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upon second thought ... While it makes sense to start the folder off with a period when it is directly in the home directory - so as to have it default hidden, doing so while under
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So change |
||
} else { | ||
var rc_path = userhome+"/.bmndrrc"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As in something like this?
|
||
} | ||
|
||
|
||
var exists = fs.existsSync(rc_path); | ||
var rc = exists && fs.readFileSync(rc_path, 'utf8'); | ||
|
@@ -193,7 +198,7 @@ if (argv.help) { | |
printHelp(); | ||
} | ||
} else { | ||
console.log("No ~/.bmndrrc detected... starting authentication process..."); | ||
console.log(`No ${rc_path} detected... starting authentication process...`); | ||
var open; | ||
if (process.platform === 'linux') { | ||
open = 'xdg-open'; | ||
|
@@ -209,7 +214,7 @@ if (argv.help) { | |
if (err) { return onErr(err); } | ||
fs.writeFile(rc_path, "[account]\nauth_token: "+result.auth_token+"\n", function (errf) { | ||
if (errf) { return onErr(errf); } | ||
console.log("Successfully wrote auth_token to ~/.bmndrrc"); | ||
console.log(`Successfully wrote auth_token to ${rc_path}`); | ||
}); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see these are all
var
s and maybe that is standard javascript. 🤷🏿At first glance a
const
seems more appropriate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was more about maintaining consistency with the rest of the file.