From 60c8b7530b50536a2a06b357c2f8a3ba0e081fd1 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 3 Aug 2017 17:48:14 +0000 Subject: [PATCH] Removing vorpal --- CliClient/app/app.js | 270 +++++++++++++++++---- CliClient/app/cli-utils.js | 41 ++++ CliClient/app/command-autocompletion.js | 41 ++++ CliClient/app/command-edit.js | 8 +- CliClient/app/command-import-enex.js | 10 +- CliClient/app/command-ls.js | 4 +- CliClient/app/command-rm.js | 5 +- CliClient/app/command-search.js | 1 - CliClient/app/command-sync.js | 7 +- CliClient/app/main.js | 8 +- CliClient/app/main_launcher.js | 11 + CliClient/build.sh | 5 +- CliClient/locales/en_GB.po | 15 +- CliClient/locales/fr_FR.po | 29 +-- CliClient/locales/joplin.pot | 15 +- CliClient/package.json | 5 +- CliClient/run.sh | 1 + CliClient/yarn.lock | 14 ++ ReactNativeClient/android/app/build.gradle | 4 +- 19 files changed, 393 insertions(+), 101 deletions(-) create mode 100644 CliClient/app/cli-utils.js create mode 100644 CliClient/app/command-autocompletion.js diff --git a/CliClient/app/app.js b/CliClient/app/app.js index 8dc195bc4a..995c4b2ace 100644 --- a/CliClient/app/app.js +++ b/CliClient/app/app.js @@ -8,12 +8,13 @@ import { Note } from 'lib/models/note.js'; import { Setting } from 'lib/models/setting.js'; import { Logger } from 'lib/logger.js'; import { sprintf } from 'sprintf-js'; -import { vorpalUtils } from 'vorpal-utils.js'; import { reg } from 'lib/registry.js'; import { fileExtension } from 'lib/path-utils.js'; import { _, setLocale, defaultLocale, closestSupportedLocale } from 'lib/locale.js'; import os from 'os'; import fs from 'fs-extra'; +import yargParser from 'yargs-parser'; +import omelette from 'omelette'; class Application { @@ -23,9 +24,9 @@ class Application { this.dbLogger_ = new Logger(); } - vorpal() { - return this.vorpal_; - } + // vorpal() { + // return this.vorpal_; + // } currentFolder() { return this.currentFolder_; @@ -40,22 +41,9 @@ class Application { this.switchCurrentFolder(newFolder); } - updatePrompt() { - if (!this.showPromptString_) return ''; - - let path = ''; - if (this.currentFolder()) { - path += '/' + this.currentFolder().title; - } - const prompt = Setting.value('appName') + ':' + path + '$ '; - - this.vorpal().delimiter(prompt); - } - switchCurrentFolder(folder) { this.currentFolder_ = folder; Setting.setValue('activeFolderId', folder ? folder.id : ''); - this.updatePrompt(); } async guessTypeAndLoadItem(pattern, options = null) { @@ -132,11 +120,11 @@ class Application { continue; } - if (arg == '--redraw-disabled') { - vorpalUtils.setRedrawEnabled(false); - argv.splice(0, 1); - continue; - } + // if (arg == '--redraw-disabled') { + // vorpalUtils.setRedrawEnabled(false); + // argv.splice(0, 1); + // continue; + // } if (arg == '--update-geolocation-disabled') { Note.updateGeolocationEnabled_ = false; @@ -145,7 +133,7 @@ class Application { } if (arg == '--stack-trace-enabled') { - vorpalUtils.setStackTraceEnabled(true); + //vorpalUtils.setStackTraceEnabled(true); argv.splice(0, 1); continue; } @@ -157,6 +145,12 @@ class Application { continue; } + if (arg == '--completion' || arg == '--compbash' || arg == '--compgen') { + // Handled by omelette + argv.splice(0, 1); + continue; + } + if (arg.length && arg[0] == '-') { throw new Error(_('Unknown flag: %s', arg)); } else { @@ -190,6 +184,8 @@ class Application { } onLocaleChanged() { + return; + let currentCommands = this.vorpal().commands; for (let i = 0; i < currentCommands.length; i++) { let cmd = currentCommands[i]; @@ -204,6 +200,8 @@ class Application { } loadCommands_() { + return; + this.onLocaleChanged(); // Ensures that help and exit commands are translated fs.readdirSync(__dirname).forEach((path) => { @@ -272,10 +270,120 @@ class Application { } } - async start() { - this.vorpal_ = require('vorpal')(); - vorpalUtils.initialize(this.vorpal()); + findCommandByName(name) { + let CommandClass = null; + try { + CommandClass = require('./command-' + name + '.js'); + } catch (error) { + let e = new Error('No such command: ' + name); + e.type = 'notFound'; + throw e; + } + let cmd = new CommandClass(); + cmd.log = (...object) => { + return console.log(...object); + } + + return cmd; + } + + makeCommandArgs(cmd, argv) { + let cmdUsage = cmd.usage(); + cmdUsage = yargParser(cmdUsage); + let output = {}; + + let options = cmd.options(); + let booleanFlags = []; + let aliases = {}; + for (let i = 0; i < options.length; i++) { + if (options[i].length != 2) throw new Error('Invalid options: ' + options[i]); + let flags = options[i][0]; + let text = options[i][1]; + + flags = this.parseFlags(flags); + + if (!flags.arg) { + booleanFlags.push(flags.short); + if (flags.long) booleanFlags.push(flags.long); + } + + if (flags.short && flags.long) { + aliases[flags.long] = [flags.short]; + } + } + + let args = yargParser(argv, { + boolean: booleanFlags, + alias: aliases, + }); + + for (let i = 1; i < cmdUsage['_'].length; i++) { + const a = this.parseCommandArg(cmdUsage['_'][i]); + if (a.required && !args['_'][i]) throw new Error('Missing required arg: ' + a.name); + if (i >= a.length) { + output[a.name] = null; + } else { + output[a.name] = args['_'][i]; + } + } + + let argOptions = {}; + for (let key in args) { + if (!args.hasOwnProperty(key)) continue; + if (key == '_') continue; + argOptions[key] = args[key]; + } + + output.options = argOptions; + + return output; + } + + parseFlags(flags) { + let output = {}; + flags = flags.split(','); + for (let i = 0; i < flags.length; i++) { + let f = flags[i].trim(); + + if (f.substr(0, 2) == '--') { + f = f.split(' '); + output.long = f[0].substr(2).trim(); + if (f.length == 2) { + output.arg = this.parseCommandArg(f[1].trim()); + } + } else if (f.substr(0, 1) == '-') { + output.short = f.substr(1); + } + } + return output; + } + + parseCommandArg(arg) { + if (arg.length <= 2) throw new Error('Invalid command arg: ' + arg); + + const c1 = arg[0]; + const c2 = arg[arg.length - 1]; + const name = arg.substr(1, arg.length - 2); + + if (c1 == '<' && c2 == '>') { + return { required: true, name: name }; + } else if (c1 == '[' && c2 == ']') { + return { required: false, name: name }; + } else { + throw new Error('Invalid command arg: ' + arg); + } + } + + async execCommand(argv) { + if (!argv.length) throw new Error('Empty command'); + const commandName = argv[0]; + const command = this.findCommandByName(commandName); + const cmdArgs = this.makeCommandArgs(command, argv); + await command.action(cmdArgs); + } + + async start() { let argv = process.argv; let startFlags = await this.handleStartFlags_(argv); argv = startFlags.argv; @@ -330,7 +438,7 @@ class Application { setLocale(Setting.value('locale')); - this.loadCommands_(); + //this.loadCommands_(); let currentFolderId = Setting.value('activeFolderId'); this.currentFolder_ = null; @@ -338,25 +446,101 @@ class Application { if (!this.currentFolder_) this.currentFolder_ = await Folder.defaultFolder(); Setting.setValue('activeFolderId', this.currentFolder_ ? this.currentFolder_.id : ''); - if (this.currentFolder_) await this.vorpal().exec('use ' + this.escapeShellArg(this.currentFolder_.title)); - // If we still have arguments, pass it to Vorpal and exit - if (argv.length) { - let cmd = this.shellArgsToString(argv); - await this.vorpal().exec(cmd); - } else { - setInterval(() => { - reg.scheduleSync(0); - }, 1000 * 60 * 5); + const completion = omelette(`joplindev `); - this.updatePrompt(); - this.vorpal().show(); - this.vorpal().history(Setting.value('appId')); // Enables persistent history - if (!this.currentFolder()) { - this.vorpal().log(_('No notebook is defined. Create one with `mkbook <notebook>`.')); - } - } + // Bind events for every template part. + completion.on('title', ({ before, reply }) => { + const child_process = require('child_process'); + const stdout = child_process.execSync('joplindev autocompletion --before "' + before + '" notes'); + reply(JSON.parse(stdout)); + }); + + // Initialize the omelette. + completion.init() + + + // const omelCommand = ({ before, reply }) => { + // reply([ 'cat', 'ls' ]); + // } + + // const omelTitle = ({ reply }) => { + // if (this.currentFolder_) { + // Note.previews(this.currentFolder_.id).then((notes) => { + // console.info(notes.length); + // const output = notes.map((n) => n.title); + // reply(['aa']); + // //reply(output); + // }); + // } else { + // reply([]); + // } + // } + + // omelette`joplindev ${omelCommand} ${omelTitle}`.init() + + + + + + + + + + this.execCommand(argv); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // if (this.currentFolder_) await this.vorpal().exec('use ' + this.escapeShellArg(this.currentFolder_.title)); + + // // If we still have arguments, pass it to Vorpal and exit + // if (argv.length) { + // let cmd = this.shellArgsToString(argv); + // await this.vorpal().exec(cmd); + // } else { + + // setInterval(() => { + // reg.scheduleSync(0); + // }, 1000 * 60 * 5); + + // this.updatePrompt(); + // this.vorpal().show(); + // this.vorpal().history(Setting.value('appId')); // Enables persistent history + // if (!this.currentFolder()) { + // this.vorpal().log(_('No notebook is defined. Create one with `mkbook <notebook>`.')); + // } + // } } } diff --git a/CliClient/app/cli-utils.js b/CliClient/app/cli-utils.js new file mode 100644 index 0000000000..0b832bfe09 --- /dev/null +++ b/CliClient/app/cli-utils.js @@ -0,0 +1,41 @@ +const stringPadding = require('string-padding'); + +const cliUtils = { + + printArray: function(logFunction, rows, headers = null) { + if (!rows.length) return ''; + + const ALIGN_LEFT = 0; + const ALIGN_RIGHT = 1; + + let colWidths = []; + let colAligns = []; + + for (let i = 0; i < rows.length; i++) { + let row = rows[i]; + + for (let j = 0; j < row.length; j++) { + let item = row[j]; + let width = item ? item.toString().length : 0; + let align = typeof item == 'number' ? ALIGN_RIGHT : ALIGN_LEFT; + if (!colWidths[j] || colWidths[j] < width) colWidths[j] = width; + if (colAligns.length <= j) colAligns[j] = align; + } + } + + let lines = []; + for (let row = 0; row < rows.length; row++) { + let line = []; + for (let col = 0; col < colWidths.length; col++) { + let item = rows[row][col]; + let width = colWidths[col]; + let dir = colAligns[col] == ALIGN_LEFT ? stringPadding.RIGHT : stringPadding.LEFT; + line.push(stringPadding(item, width, ' ', dir)); + } + logFunction(line.join(' ')); + } + }, + +} + +export { cliUtils }; \ No newline at end of file diff --git a/CliClient/app/command-autocompletion.js b/CliClient/app/command-autocompletion.js new file mode 100644 index 0000000000..ba34e14f0d --- /dev/null +++ b/CliClient/app/command-autocompletion.js @@ -0,0 +1,41 @@ +import { BaseCommand } from './base-command.js'; +import { app } from './app.js'; +import { _ } from 'lib/locale.js'; +import { Note } from 'lib/models/note.js'; + +class Command extends BaseCommand { + + usage() { + return 'autocompletion <type> [arg1]'; + } + + description() { + return 'Helper for autocompletion'; + } + + options() { + return [ + [ '--before <before>', 'before' ], + ]; + } + + hidden() { + return true; + } + + async action(args) { + let output = []; + if (args.type == 'notes') { + // TODO: + if (!app().currentFolder()) throw new Error('no current folder'); + let options = {}; + if (args.options.before) options.titlePattern = args.options.before + '*'; + const notes = await Note.previews(app().currentFolder().id, options); + output = notes.map((n) => n.title); + } + this.log(JSON.stringify(output)); + } + +} + +module.exports = Command; \ No newline at end of file diff --git a/CliClient/app/command-edit.js b/CliClient/app/command-edit.js index ec5589ecb4..34dca99ec1 100644 --- a/CliClient/app/command-edit.js +++ b/CliClient/app/command-edit.js @@ -2,7 +2,6 @@ import fs from 'fs-extra'; import { BaseCommand } from './base-command.js'; import { app } from './app.js'; import { _ } from 'lib/locale.js'; -import { vorpalUtils } from './vorpal-utils.js'; import { Folder } from 'lib/models/folder.js'; import { Note } from 'lib/models/note.js'; import { Setting } from 'lib/models/setting.js'; @@ -29,7 +28,7 @@ class Command extends BaseCommand { const onFinishedEditing = async () => { if (watcher) watcher.close(); - app().vorpal().show(); + //app().vorpal().show(); newNote = null; this.log(_('Done editing.')); } @@ -47,6 +46,9 @@ class Command extends BaseCommand { let note = await app().loadItem(BaseModel.TYPE_NOTE, title); if (!note) { + // TODO + throw new Error(_('Note does not exist.')); + let ok = await vorpalUtils.cmdPromptConfirm(this, _('Note does not exist: "%s". Create it?', title)) if (!ok) return; newNote = await Note.save({ title: title, parent_id: app().currentFolder().id }); @@ -68,7 +70,7 @@ class Command extends BaseCommand { this.log(_('Starting to edit note. Close the editor to get back to the prompt.')); - app().vorpal().hide(); + //app().vorpal().hide(); await fs.writeFile(tempFilePath, content); diff --git a/CliClient/app/command-import-enex.js b/CliClient/app/command-import-enex.js index 65eb860344..a3264bdb3d 100644 --- a/CliClient/app/command-import-enex.js +++ b/CliClient/app/command-import-enex.js @@ -2,7 +2,6 @@ import { BaseCommand } from './base-command.js'; import { app } from './app.js'; import { _ } from 'lib/locale.js'; import { Folder } from 'lib/models/folder.js'; -import { vorpalUtils } from './vorpal-utils.js'; import { importEnex } from 'import-enex'; import { filename, basename } from 'lib/path-utils.js'; @@ -29,6 +28,11 @@ class Command extends BaseCommand { let folderTitle = args['notebook']; let force = args.options.force === true; + + + force = true; // TODO + + if (!folderTitle) folderTitle = filename(filePath); folder = await Folder.loadByField('title', folderTitle); const msg = folder ? _('File "%s" will be imported into existing notebook "%s". Continue?', basename(filePath), folderTitle) : _('New notebook "%s" will be created and file "%s" will be imported into it. Continue?', folderTitle, basename(filePath)); @@ -46,10 +50,10 @@ class Command extends BaseCommand { if (progressState.skipped) line.push(_('Skipped: %d.', progressState.skipped)); if (progressState.resourcesCreated) line.push(_('Resources: %d.', progressState.resourcesCreated)); if (progressState.notesTagged) line.push(_('Tagged: %d.', progressState.notesTagged)); - vorpalUtils.redraw(line.join(' ')); + this.log(line.join(' ')); // TODO + //vorpalUtils.redraw(line.join(' ')); }, onError: (error) => { - vorpalUtils.redrawDone(); let s = error.trace ? error.trace : error.toString(); this.log(s); }, diff --git a/CliClient/app/command-ls.js b/CliClient/app/command-ls.js index 77d6c63303..30514515a1 100644 --- a/CliClient/app/command-ls.js +++ b/CliClient/app/command-ls.js @@ -8,7 +8,7 @@ import { Note } from 'lib/models/note.js'; import { autocompleteFolders } from './autocomplete.js'; import { sprintf } from 'sprintf-js'; import { time } from 'lib/time-utils.js'; -import { vorpalUtils } from './vorpal-utils.js'; +import { cliUtils } from './cli-utils.js'; class Command extends BaseCommand { @@ -117,7 +117,7 @@ class Command extends BaseCommand { rows.push(row); } - vorpalUtils.printArray(this, rows); + cliUtils.printArray(this.log, rows); } } diff --git a/CliClient/app/command-rm.js b/CliClient/app/command-rm.js index 088f5b5672..c523c3a507 100644 --- a/CliClient/app/command-rm.js +++ b/CliClient/app/command-rm.js @@ -6,7 +6,6 @@ import { Folder } from 'lib/models/folder.js'; import { Note } from 'lib/models/note.js'; import { BaseModel } from 'lib/base-model.js'; import { autocompleteItems } from './autocomplete.js'; -import { vorpalUtils } from './vorpal-utils.js'; class Command extends BaseCommand { @@ -32,12 +31,12 @@ class Command extends BaseCommand { async action(args) { const pattern = args['pattern'].toString(); const recursive = args.options && args.options.recursive === true; - const force = args.options && args.options.force === true; + const force = true || args.options && args.options.force === true; // TODO if (recursive) { const folder = await app().loadItem(BaseModel.TYPE_FOLDER, pattern); if (!folder) throw new Error(_('Cannot find "%s".', pattern)); - const ok = force ? true : await vorpalUtils.cmdPromptConfirm(this, _('Delete notebook "%s"?', folder.title)); + //const ok = force ? true : await vorpalUtils.cmdPromptConfirm(this, _('Delete notebook "%s"?', folder.title)); if (!ok) return; await Folder.delete(folder.id); await app().refreshCurrentFolder(); diff --git a/CliClient/app/command-search.js b/CliClient/app/command-search.js index 0e5de29aaa..81f05e00e6 100644 --- a/CliClient/app/command-search.js +++ b/CliClient/app/command-search.js @@ -7,7 +7,6 @@ import { Note } from 'lib/models/note.js'; import { autocompleteFolders } from './autocomplete.js'; import { sprintf } from 'sprintf-js'; import { time } from 'lib/time-utils.js'; -import { vorpalUtils } from './vorpal-utils.js'; class Command extends BaseCommand { diff --git a/CliClient/app/command-sync.js b/CliClient/app/command-sync.js index a75d7a9c63..a7f9e4b8f3 100644 --- a/CliClient/app/command-sync.js +++ b/CliClient/app/command-sync.js @@ -4,7 +4,6 @@ import { _ } from 'lib/locale.js'; import { OneDriveApiNodeUtils } from './onedrive-api-node-utils.js'; import { Setting } from 'lib/models/setting.js'; import { BaseItem } from 'lib/models/base-item.js'; -import { vorpalUtils } from './vorpal-utils.js'; import { Synchronizer } from 'lib/synchronizer.js'; import { reg } from 'lib/registry.js'; import md5 from 'md5'; @@ -88,7 +87,8 @@ class Command extends BaseCommand { let options = { onProgress: (report) => { let lines = Synchronizer.reportToLines(report); - if (lines.length) vorpalUtils.redraw(lines.join(' ')); + //if (lines.length) vorpalUtils.redraw(lines.join(' ')); + if (lines.length) this.log(lines.join(' ')); // TODO }, onMessage: (msg) => { vorpalUtils.redrawDone(); @@ -117,8 +117,6 @@ class Command extends BaseCommand { throw error; } } - - vorpalUtils.redrawDone(); await app().refreshCurrentFolder(); @@ -136,7 +134,6 @@ class Command extends BaseCommand { async cancel() { const target = this.syncTarget_ ? this.syncTarget_ : Setting.value('sync.target'); - vorpalUtils.redrawDone(); this.log(_('Cancelling...')); if (reg.syncHasAuth(target)) { diff --git a/CliClient/app/main.js b/CliClient/app/main.js index fb85345368..e282c8692c 100644 --- a/CliClient/app/main.js +++ b/CliClient/app/main.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +// Loading time: 20170803: 1.5s with no commands + require('source-map-support').install(); require('babel-plugin-transform-runtime'); @@ -36,12 +38,6 @@ BaseItem.loadClass('NoteTag', NoteTag); Setting.setConstant('appId', 'net.cozic.joplin-cli'); Setting.setConstant('appType', 'cli'); -process.stdin.on('keypress', (_, key) => { - if (key && key.name === 'return') { - app().updatePrompt(); - } -}); - shimInit(); app().start().catch((error) => { diff --git a/CliClient/app/main_launcher.js b/CliClient/app/main_launcher.js index 4a6180ec5e..6fb802276a 100644 --- a/CliClient/app/main_launcher.js +++ b/CliClient/app/main_launcher.js @@ -12,6 +12,17 @@ var spawn = require('child_process').spawn; var args = ['main.js']; + +if (process.argv[1].indexOf('joplindev') >= 0) { + args.push('--profile'); + args.push('/mnt/d/Temp/TestNotes2'); + args.push('--stack-trace-enabled'); + args.push('--log-level'); + args.push('debug'); + args.push('--env'); + args.push('dev'); +} + var processArgs = process.argv.splice(2); args = args.concat(processArgs); diff --git a/CliClient/build.sh b/CliClient/build.sh index 4c5cd8a62c..857fec54c1 100755 --- a/CliClient/build.sh +++ b/CliClient/build.sh @@ -8,6 +8,7 @@ rm -f "$CLIENT_DIR/app/lib" ln -s "$CLIENT_DIR/../ReactNativeClient/lib" "$CLIENT_DIR/app" cp "$CLIENT_DIR/package.json" "$CLIENT_DIR/build" -yarn run build +npm run build +#yarn run build -NODE_PATH="$CLIENT_DIR/build" node "$CLIENT_DIR/build/build-translation.js" --silent \ No newline at end of file +#NODE_PATH="$CLIENT_DIR/build" node "$CLIENT_DIR/build/build-translation.js" --silent \ No newline at end of file diff --git a/CliClient/locales/en_GB.po b/CliClient/locales/en_GB.po index 705468b199..3eecdc7e48 100644 --- a/CliClient/locales/en_GB.po +++ b/CliClient/locales/en_GB.po @@ -41,9 +41,6 @@ msgstr "" msgid "Exits the application." msgstr "" -msgid "No notebook is defined. Create one with `mkbook <notebook>`." -msgstr "" - msgid "Displays the given note." msgstr "" @@ -89,6 +86,9 @@ msgstr "" msgid "No active notebook." msgstr "" +msgid "Note does not exist." +msgstr "" + #, javascript-format msgid "Note does not exist: \"%s\". Create it?" msgstr "" @@ -200,10 +200,6 @@ msgstr "" msgid "Deletes a notebook." msgstr "" -#, javascript-format -msgid "Delete notebook \"%s\"?" -msgstr "" - #, javascript-format msgid "%d notes match this pattern. Delete them?" msgstr "" @@ -319,7 +315,7 @@ msgid "Deleted remote items: %d." msgstr "" #, javascript-format -msgid "State: %s." +msgid "State: \"%s\"." msgstr "" #, javascript-format @@ -487,6 +483,9 @@ msgstr "" msgid "Delete note?" msgstr "" +msgid "Attach file" +msgstr "" + msgid "Delete note" msgstr "" diff --git a/CliClient/locales/fr_FR.po b/CliClient/locales/fr_FR.po index 94fe25e547..49de6afae0 100644 --- a/CliClient/locales/fr_FR.po +++ b/CliClient/locales/fr_FR.po @@ -14,8 +14,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.3\n" -"POT-Creation-Date: \n" -"PO-Revision-Date: \n" msgid "No notebook selected." msgstr "Aucun carnet n'est sélectionné." @@ -45,9 +43,6 @@ msgstr "Affiche l'aide pour la commande donnée." msgid "Exits the application." msgstr "Quitter le logiciel." -msgid "No notebook is defined. Create one with `mkbook <notebook>`." -msgstr "Aucun carnet n'est défini. Créez-en un avec `mkbook <carnet>`." - msgid "Displays the given note." msgstr "Affiche la note." @@ -100,6 +95,10 @@ msgstr "" msgid "No active notebook." msgstr "Aucun carnet actif." +#, fuzzy +msgid "Note does not exist." +msgstr "Ce carnet n'existe pas : \"%s\". Le créer ?" + #, javascript-format msgid "Note does not exist: \"%s\". Create it?" msgstr "Ce carnet n'existe pas : \"%s\". Le créer ?" @@ -227,10 +226,6 @@ msgstr "Supprime les objets sans demander la confirmation." msgid "Deletes a notebook." msgstr "Supprime le carnet." -#, javascript-format -msgid "Delete notebook \"%s\"?" -msgstr "Supprimer le carnet \"%s\" ?" - #, javascript-format msgid "%d notes match this pattern. Delete them?" msgstr "%d notes correspondent à ce motif. Les supprimer ?" @@ -362,8 +357,8 @@ msgstr "Objets supprimés localement : %d." msgid "Deleted remote items: %d." msgstr "Objets distants supprimés : %d." -#, javascript-format -msgid "State: %s." +#, fuzzy, javascript-format +msgid "State: \"%s\"." msgstr "Etat : %s." #, javascript-format @@ -533,6 +528,9 @@ msgstr "Sans titre" msgid "Delete note?" msgstr "Supprimer la note ?" +msgid "Attach file" +msgstr "Attacher un fichier" + msgid "Delete note" msgstr "Supprimer la note" @@ -581,6 +579,12 @@ msgstr "" msgid "Welcome" msgstr "Bienvenue" +#~ msgid "Delete notebook \"%s\"?" +#~ msgstr "Supprimer le carnet \"%s\" ?" + +#~ msgid "No notebook is defined. Create one with `mkbook <notebook>`." +#~ msgstr "Aucun carnet n'est défini. Créez-en un avec `mkbook <carnet>`." + #~ msgid "NAME" #~ msgstr "NOM" @@ -654,9 +658,6 @@ msgstr "Bienvenue" #~ msgid "use <notebook>" #~ msgstr "Nouveau carnet" -#~ msgid "Attach file" -#~ msgstr "Attacher un fichier" - #~ msgid "All potential ports are in use - please report the issue at %s" #~ msgstr "" #~ "Tous les ports sont en cours d'utilisation. Veuillez signaler ce problème " diff --git a/CliClient/locales/joplin.pot b/CliClient/locales/joplin.pot index 705468b199..3eecdc7e48 100644 --- a/CliClient/locales/joplin.pot +++ b/CliClient/locales/joplin.pot @@ -41,9 +41,6 @@ msgstr "" msgid "Exits the application." msgstr "" -msgid "No notebook is defined. Create one with `mkbook <notebook>`." -msgstr "" - msgid "Displays the given note." msgstr "" @@ -89,6 +86,9 @@ msgstr "" msgid "No active notebook." msgstr "" +msgid "Note does not exist." +msgstr "" + #, javascript-format msgid "Note does not exist: \"%s\". Create it?" msgstr "" @@ -200,10 +200,6 @@ msgstr "" msgid "Deletes a notebook." msgstr "" -#, javascript-format -msgid "Delete notebook \"%s\"?" -msgstr "" - #, javascript-format msgid "%d notes match this pattern. Delete them?" msgstr "" @@ -319,7 +315,7 @@ msgid "Deleted remote items: %d." msgstr "" #, javascript-format -msgid "State: %s." +msgid "State: \"%s\"." msgstr "" #, javascript-format @@ -487,6 +483,9 @@ msgstr "" msgid "Delete note?" msgstr "" +msgid "Attach file" +msgstr "" + msgid "Delete note" msgstr "" diff --git a/CliClient/package.json b/CliClient/package.json index e54b2da30d..582494b4e9 100644 --- a/CliClient/package.json +++ b/CliClient/package.json @@ -14,6 +14,7 @@ "dependencies": { "app-module-path": "^2.2.0", "babel-plugin-transform-runtime": "^6.23.0", + "cache-require-paths": "^0.3.0", "follow-redirects": "^1.2.4", "form-data": "^2.1.4", "fs-extra": "^3.0.1", @@ -25,6 +26,7 @@ "moment": "^2.18.1", "moment-timezone": "^0.5.13", "node-fetch": "^1.7.1", + "omelette": "^0.4.4", "os-tmpdir": "^1.0.2", "promise": "^7.1.1", "proper-lockfile": "^2.0.1", @@ -38,7 +40,8 @@ "string-to-stream": "^1.1.0", "tcp-port-used": "^0.1.2", "uuid": "^3.0.1", - "vorpal": "^1.12.0" + "vorpal": "^1.12.0", + "yargs-parser": "^7.0.0" }, "devDependencies": { "babel-changed": "^7.0.0", diff --git a/CliClient/run.sh b/CliClient/run.sh index 952a655a70..99ab605ed9 100755 --- a/CliClient/run.sh +++ b/CliClient/run.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes2 --stack-trace-enabled --log-level debug --env dev "$@" #bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes import-enex --fuzzy-matching /home/laurent/Desktop/afaire.enex afaire #bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes import-enex --fuzzy-matching /home/laurent/Desktop/Laurent.enex laurent \ No newline at end of file diff --git a/CliClient/yarn.lock b/CliClient/yarn.lock index a8bac582c5..f7aa230349 100644 --- a/CliClient/yarn.lock +++ b/CliClient/yarn.lock @@ -758,6 +758,10 @@ browserslist@^2.1.2: caniuse-lite "^1.0.30000684" electron-to-chromium "^1.3.14" +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + caniuse-lite@^1.0.30000684: version "1.0.30000701" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000701.tgz#9d673cf6b74dcb3d5c21d213176b011ac6a45baa" @@ -1643,6 +1647,10 @@ object.omit@^2.0.0: for-own "^0.1.4" is-extendable "^0.1.1" +omelette@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/omelette/-/omelette-0.4.4.tgz#e8fa98cb08eeec0e402c49561fc0670c75120c89" + once@^1.3.0, once@^1.3.3: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -2174,3 +2182,9 @@ write@^0.2.1: resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" dependencies: mkdirp "^0.5.1" + +yargs-parser@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" + dependencies: + camelcase "^4.1.0" diff --git a/ReactNativeClient/android/app/build.gradle b/ReactNativeClient/android/app/build.gradle index 80bd186c62..69b88ef393 100644 --- a/ReactNativeClient/android/app/build.gradle +++ b/ReactNativeClient/android/app/build.gradle @@ -90,8 +90,8 @@ android { applicationId "net.cozic.joplin" minSdkVersion 16 targetSdkVersion 22 - versionCode 40 - versionName "0.9.27" + versionCode 41 + versionName "0.9.28" ndk { abiFilters "armeabi-v7a", "x86" }