Merge pull request #2484 from Dranaxel/refactor_source

Refactorised source_quiet in src/excmd.ts
This commit is contained in:
Oliver Blanthorn 2020-06-16 10:50:47 +01:00 committed by GitHub
commit c318373bdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -781,17 +781,9 @@ export async function source(...args: string[]) {
* Same as [[source]] but suppresses all errors
*/
//#background
export async function source_quiet(...args: string[]) {
export async function source_quiet(args: string[]) {
try {
if (args[0] === "--url") {
let url = args[1]
if (!url || url === "%") url = window.location.href
if (!(url.startsWith("http://") || url.startsWith("https://"))) url = "http://" + url
await rc.sourceFromUrl(url)
} else {
const file = args.join(" ") || undefined
if (await Native.nativegate("0.1.3", false)) rc.source(file)
}
await source(...args)
} catch (e) {
logger.info("Automatic loading of RC file failed.")
}