You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-13 22:12:50 +02:00
UI to set config
This commit is contained in:
@@ -32,7 +32,6 @@ const packageJson = require('./package.json');
|
|||||||
|
|
||||||
let initArgs = {
|
let initArgs = {
|
||||||
profileDir: null,
|
profileDir: null,
|
||||||
syncTarget: null,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentFolder = null;
|
let currentFolder = null;
|
||||||
@@ -47,17 +46,12 @@ commands.push({
|
|||||||
usage: 'root',
|
usage: 'root',
|
||||||
options: [
|
options: [
|
||||||
['--profile <filePath>', 'Sets the profile path directory.'],
|
['--profile <filePath>', 'Sets the profile path directory.'],
|
||||||
['--sync-target <target>', 'Sets the sync target.'],
|
|
||||||
],
|
],
|
||||||
action: function(args, end) {
|
action: function(args, end) {
|
||||||
if (args.profile) {
|
if (args.profile) {
|
||||||
initArgs.profileDir = args.profile;
|
initArgs.profileDir = args.profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args['sync-target']) {
|
|
||||||
initArgs.syncTarget = args['sync-target'];
|
|
||||||
}
|
|
||||||
|
|
||||||
end();
|
end();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -320,6 +314,28 @@ commands.push({
|
|||||||
autocomplete: autocompleteFolders,
|
autocomplete: autocompleteFolders,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
commands.push({
|
||||||
|
usage: 'config [name] [value]',
|
||||||
|
description: 'Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.',
|
||||||
|
action: function(args, end) {
|
||||||
|
try {
|
||||||
|
if (!args.name && !args.value) {
|
||||||
|
let keys = Setting.publicKeys();
|
||||||
|
for (let i = 0; i < keys.length; i++) {
|
||||||
|
this.log(keys[i] + ' = ' + Setting.value(keys[i]));
|
||||||
|
}
|
||||||
|
} else if (args.name && !args.value) {
|
||||||
|
this.log(args.name + ' = ' + Setting.value(args.name));
|
||||||
|
} else {
|
||||||
|
Setting.setValue(args.name, args.value);
|
||||||
|
}
|
||||||
|
} catch(error) {
|
||||||
|
this.log(error);
|
||||||
|
}
|
||||||
|
end();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
commands.push({
|
commands.push({
|
||||||
usage: 'sync',
|
usage: 'sync',
|
||||||
description: 'Synchronizes with remote storage.',
|
description: 'Synchronizes with remote storage.',
|
||||||
@@ -639,8 +655,6 @@ async function main() {
|
|||||||
BaseModel.db_ = database_;
|
BaseModel.db_ = database_;
|
||||||
await Setting.load();
|
await Setting.load();
|
||||||
|
|
||||||
if (initArgs.syncTarget) Setting.setValue('sync.target', initArgs.syncTarget);
|
|
||||||
|
|
||||||
let activeFolderId = Setting.value('activeFolderId');
|
let activeFolderId = Setting.value('activeFolderId');
|
||||||
let activeFolder = null;
|
let activeFolder = null;
|
||||||
if (activeFolderId) activeFolder = await Folder.load(activeFolderId);
|
if (activeFolderId) activeFolder = await Folder.load(activeFolderId);
|
||||||
|
Reference in New Issue
Block a user