1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

Per-target sync context

This commit is contained in:
Laurent Cozic
2017-08-19 22:56:28 +02:00
parent 0cf8d3fd74
commit a5daccce09
10 changed files with 39 additions and 27 deletions

View File

@@ -147,12 +147,6 @@ class Application {
continue;
}
if (arg == '--autocompletion') {
this.autocompletion_.active = true;
argv.splice(0, 1);
continue;
}
if (arg == '--ac-install') {
this.autocompletion_.install = true;
argv.splice(0, 1);

View File

@@ -25,20 +25,20 @@ function installAutocompletionFile(appName, profileDir) {
const filePath = profileDir + '/autocompletion.sh';
fs.writeFileSync(filePath, content);
console.info(_('Created autocompletion script "%s".', filePath));
const bashProfilePath = os.homedir() + '/.bashrc';
let bashrcContent = fs.readFileSync(bashProfilePath, 'utf8');
const lineToAdd = 'source ' + filePath;
console.info(_('Adding autocompletion script to: "%s"', bashProfilePath));
if (bashrcContent.indexOf(lineToAdd) >= 0) {
console.info(_('Autocompletion script is already installed.'));
console.info(_('Autocompletion script is already present in "%s".', bashProfilePath));
} else {
bashrcContent += "\n" + lineToAdd + "\n";
fs.writeFileSync(bashProfilePath, bashrcContent);
console.info(_('Autocompletion has been installed.'));
console.info(_('Added autocompletion to "%s".', bashProfilePath));
}
console.info(_('Sourcing "%s"...', filePath));

View File

@@ -112,13 +112,15 @@ class Command extends BaseCommand {
this.log(_('Starting synchronisation...'));
let context = Setting.value('sync.context');
const contextKey = 'sync.' + this.syncTarget_ + '.context';
let context = Setting.value(contextKey);
context = context ? JSON.parse(context) : {};
options.context = context;
try {
let newContext = await sync.start(options);
Setting.setValue('sync.context', JSON.stringify(newContext));
Setting.setValue(contextKey, JSON.stringify(newContext));
} catch (error) {
if (error.code == 'alreadyStarted') {
this.log(error.message);

View File

@@ -45,13 +45,15 @@ msgid "Only Bash is currently supported for autocompletion."
msgstr ""
#, javascript-format
msgid "Adding autocompletion script to: \"%s\""
msgid "Created autocompletion script \"%s\"."
msgstr ""
msgid "Autocompletion script is already installed."
#, javascript-format
msgid "Autocompletion script is already present in \"%s\"."
msgstr ""
msgid "Autocompletion has been installed."
#, javascript-format
msgid "Added autocompletion to \"%s\"."
msgstr ""
#, javascript-format

View File

@@ -47,13 +47,15 @@ msgid "Only Bash is currently supported for autocompletion."
msgstr ""
#, javascript-format
msgid "Adding autocompletion script to: \"%s\""
msgid "Created autocompletion script \"%s\"."
msgstr ""
msgid "Autocompletion script is already installed."
#, javascript-format
msgid "Autocompletion script is already present in \"%s\"."
msgstr ""
msgid "Autocompletion has been installed."
#, javascript-format
msgid "Added autocompletion to \"%s\"."
msgstr ""
#, javascript-format

View File

@@ -45,13 +45,15 @@ msgid "Only Bash is currently supported for autocompletion."
msgstr ""
#, javascript-format
msgid "Adding autocompletion script to: \"%s\""
msgid "Created autocompletion script \"%s\"."
msgstr ""
msgid "Autocompletion script is already installed."
#, javascript-format
msgid "Autocompletion script is already present in \"%s\"."
msgstr ""
msgid "Autocompletion has been installed."
#, javascript-format
msgid "Added autocompletion to \"%s\"."
msgstr ""
#, javascript-format