mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Fixed various bugs
This commit is contained in:
parent
5a434bb771
commit
3f50e419da
@ -131,6 +131,12 @@ class Application {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (arg == '--update-geolocation-disabled') {
|
||||
Note.updateGeolocationEnabled_ = false;
|
||||
argv.splice(0, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (arg == '--stack-trace-enabled') {
|
||||
vorpalUtils.setStackTraceEnabled(true);
|
||||
argv.splice(0, 1);
|
||||
@ -319,8 +325,6 @@ class Application {
|
||||
if (argv.length) {
|
||||
let cmd = this.shellArgsToString(argv);
|
||||
await this.vorpal().exec(cmd);
|
||||
await this.vorpal().exec('exit');
|
||||
return;
|
||||
} else {
|
||||
this.updatePrompt();
|
||||
this.vorpal().show();
|
||||
|
@ -80,6 +80,7 @@ class Command extends BaseCommand {
|
||||
this.log(line);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ class Command extends BaseCommand {
|
||||
}
|
||||
|
||||
let item = item = await app().loadItem(itemType, pattern); // await BaseItem.loadItemByField(itemType, 'title', pattern);
|
||||
if (!item) throw new Error(_('No item with "%s" found.', pattern));
|
||||
if (!item) throw new Error(_('No item "%s" found.', pattern));
|
||||
|
||||
let ok = force ? true : await vorpalUtils.cmdPromptConfirm(this, _('Delete "%s"?', item.title));
|
||||
if (ok) {
|
||||
await BaseItem.deleteItem(itemType, item.id);
|
||||
if (app().currentFolder() && app().currentFolder().id == item.id) {
|
||||
let f = await Folder.defaultFolder();
|
||||
switchCurrentFolder(f);
|
||||
app().switchCurrentFolder(f);
|
||||
}
|
||||
}
|
||||
} else { // Handle it as a glob pattern
|
||||
|
@ -63,7 +63,7 @@ function randomWord() {
|
||||
|
||||
function execCommand(client, command, options = {}) {
|
||||
let exePath = 'node ' + joplinAppPath;
|
||||
let cmd = exePath + ' --env dev --profile ' + client.profileDir + ' ' + command;
|
||||
let cmd = exePath + ' --update-geolocation-disabled --env dev --profile ' + client.profileDir + ' ' + command;
|
||||
logger.info(client.id + ': ' + command);
|
||||
|
||||
if (options.killAfter) {
|
||||
@ -132,9 +132,9 @@ async function execRandomCommand(client) {
|
||||
if (!item) return;
|
||||
|
||||
if (item.type_ == 1) {
|
||||
return execCommand(client, 'rm -f ' + item.title);
|
||||
return execCommand(client, 'rm -f ' + item.id);
|
||||
} else if (item.type_ == 2) {
|
||||
return execCommand(client, 'rm -f ' + '../' + item.title);
|
||||
return execCommand(client, 'rm -f ' + '../' + item.id);
|
||||
} else if (item.type_ == 5) {
|
||||
// tag
|
||||
} else {
|
||||
@ -166,7 +166,7 @@ async function execRandomCommand(client) {
|
||||
let tag = randomTag(items);
|
||||
let tagTitle = !tag || Math.random() >= 0.9 ? 'tag-' + randomWord() : tag.title;
|
||||
|
||||
return execCommand(client, 'tag add ' + tagTitle + ' "' + note.title + '"');
|
||||
return execCommand(client, 'tag add ' + tagTitle + ' ' + note.id);
|
||||
}, 50],
|
||||
];
|
||||
|
||||
|
@ -96,6 +96,8 @@ class Note extends BaseItem {
|
||||
}
|
||||
|
||||
static updateGeolocation(noteId) {
|
||||
if (!Note.updateGeolocationEnabled_) return;
|
||||
|
||||
this.logger().info('Updating lat/long of note ' + noteId);
|
||||
|
||||
let geoData = null;
|
||||
@ -144,4 +146,6 @@ class Note extends BaseItem {
|
||||
|
||||
}
|
||||
|
||||
Note.updateGeolocationEnabled_ = true;
|
||||
|
||||
export { Note };
|
Loading…
Reference in New Issue
Block a user