1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Minor changes and updated doc

This commit is contained in:
Laurent Cozic 2017-10-29 15:41:30 +00:00
parent c73a9b6d8e
commit 8dd844d79e
10 changed files with 344 additions and 132 deletions

View File

@ -276,6 +276,45 @@ class AppGui {
isDocOnly: true, isDocOnly: true,
} }
shortcuts[':'] = {
description: _('Enter command line mode'),
action: async () => {
const cmd = await this.widget('statusBar').prompt();
if (!cmd) return;
this.addCommandToConsole(cmd);
await this.processCommand(cmd);
},
};
shortcuts['ESC'] = { // Built into terminal-kit inputField
description: _('Exit command line mode'),
isDocOnly: true,
};
shortcuts['ENTER'] = {
description: null,
action: () => {
const w = this.widget('mainWindow').focusedWidget;
if (w.name === 'folderList') {
this.widget('noteList').focus();
} else if (w.name === 'noteList' || w.name === 'noteText') {
this.processCommand('edit $n');
}
},
}
shortcuts['CTRL_C'] = {
description: _('Cancel the current command.'),
friendlyName: 'Ctrl+C',
isDocOnly: true,
}
shortcuts['CTRL_D'] = {
description: _('Exit the application.'),
friendlyName: 'Ctrl+D',
isDocOnly: true,
}
shortcuts['DELETE'] = { shortcuts['DELETE'] = {
description: _('Delete the currently selected note or notebook.'), description: _('Delete the currently selected note or notebook.'),
action: async () => { action: async () => {
@ -330,66 +369,27 @@ class AppGui {
canRunAlongOtherCommands: true, canRunAlongOtherCommands: true,
} }
shortcuts[':'] = { shortcuts['mn'] = {
description: _('Enter command line mode'), description: _('[M]ake a new [n]ote'),
action: async () => {
const cmd = await this.widget('statusBar').prompt();
if (!cmd) return;
this.addCommandToConsole(cmd);
await this.processCommand(cmd);
},
};
shortcuts['ESC'] = { // Built into terminal-kit inputField
description: _('Exit command line mode'),
isDocOnly: true,
};
shortcuts['ENTER'] = {
description: null,
action: () => {
const w = this.widget('mainWindow').focusedWidget;
if (w.name === 'folderList') {
this.widget('noteList').focus();
} else if (w.name === 'noteList' || w.name === 'noteText') {
this.processCommand('edit $n');
}
},
}
shortcuts['CTRL_C'] = {
description: _('Cancel the current command.'),
friendlyName: 'Ctrl+C',
isDocOnly: true,
}
shortcuts['CTRL_D'] = {
description: _('Exit the application.'),
friendlyName: 'Ctrl+D',
isDocOnly: true,
}
shortcuts['nn'] = {
description: _('Create a [n]ew [n]ote'),
action: { type: 'prompt', initialText: 'mknote ""', cursorPosition: -2 }, action: { type: 'prompt', initialText: 'mknote ""', cursorPosition: -2 },
} }
shortcuts['nt'] = { shortcuts['mt'] = {
description: _('Create a [n]ew [t]odo'), description: _('[M]ake a new [t]odo'),
action: { type: 'prompt', initialText: 'mktodo ""', cursorPosition: -2 }, action: { type: 'prompt', initialText: 'mktodo ""', cursorPosition: -2 },
} }
shortcuts['nb'] = { shortcuts['mb'] = {
description: _('Create a [n]ew [n]otebook'), description: _('[M]ake a new note[b]ook'),
action: { type: 'prompt', initialText: 'mkbook ""', cursorPosition: -2 }, action: { type: 'prompt', initialText: 'mkbook ""', cursorPosition: -2 },
} }
shortcuts['cp'] = { shortcuts['yn'] = {
description: _('Copy the note to a notebook.'), description: _('Copy ([Y]ank) the [n]ote to a notebook.'),
action: { type: 'prompt', initialText: 'cp $n ""', cursorPosition: -2 }, action: { type: 'prompt', initialText: 'cp $n ""', cursorPosition: -2 },
} }
shortcuts['mv'] = { shortcuts['dn'] = {
description: _('Move the note to a notebook.'), description: _('Move the note to a notebook.'),
action: { type: 'prompt', initialText: 'mv $n ""', cursorPosition: -2 }, action: { type: 'prompt', initialText: 'mv $n ""', cursorPosition: -2 },
} }

View File

@ -105,7 +105,7 @@ function getFooter() {
output.push('WEBSITE'); output.push('WEBSITE');
output.push(''); output.push('');
output.push(INDENT + 'http://joplin.cozic.net'); output.push(INDENT + 'https://joplin.cozic.net');
output.push(''); output.push('');

View File

@ -17,10 +17,30 @@ class Command extends BaseCommand {
return _('Displays usage information.'); return _('Displays usage information.');
} }
allCommands() {
const commands = app().commands();
let output = [];
for (let n in commands) {
if (!commands.hasOwnProperty(n)) continue;
const command = commands[n];
if (command.hidden()) continue;
if (!command.enabled()) continue;
output.push(command);
}
output.sort((a, b) => a.name() < b.name() ? -1 : +1);
return output;
}
async action(args) { async action(args) {
const stdoutWidth = app().commandStdoutMaxWidth(); const stdoutWidth = app().commandStdoutMaxWidth();
if (args.command === 'shortcuts') { if (args.command === 'shortcuts') {
if (app().gui().isDummy()) {
throw new Error(_('Shortcuts are not available in CLI mode.'));
}
const shortcuts = app().gui().shortcuts(); const shortcuts = app().gui().shortcuts();
let rows = []; let rows = [];
@ -34,21 +54,16 @@ class Command extends BaseCommand {
} }
cliUtils.printArray(this.stdout.bind(this), rows); cliUtils.printArray(this.stdout.bind(this), rows);
} else if (args.command === 'all') {
const commands = this.allCommands();
const output = commands.map((c) => renderCommandHelp(c));
this.stdout(output.join('\n\n'));
} else if (args.command) { } else if (args.command) {
const command = app().findCommandByName(args['command']); const command = app().findCommandByName(args['command']);
if (!command) throw new Error(_('Cannot find "%s".', args.command)); if (!command) throw new Error(_('Cannot find "%s".', args.command));
this.stdout(renderCommandHelp(command, stdoutWidth)); this.stdout(renderCommandHelp(command, stdoutWidth));
} else { } else {
const commands = app().commands(); const commandNames = this.allCommands().map((a) => a.name());
let commandNames = [];
for (let n in commands) {
if (!commands.hasOwnProperty(n)) continue;
const command = commands[n];
if (command.hidden()) continue;
commandNames.push(command.name());
}
commandNames.sort();
this.stdout(_('Type `help [command]` for more information about a command.')); this.stdout(_('Type `help [command]` for more information about a command.'));
this.stdout(''); this.stdout('');

View File

@ -21,6 +21,18 @@ msgstr ""
msgid "Give focus to previous widget" msgid "Give focus to previous widget"
msgstr "" msgstr ""
msgid "Enter command line mode"
msgstr ""
msgid "Exit command line mode"
msgstr ""
msgid "Cancel the current command."
msgstr ""
msgid "Exit the application."
msgstr ""
msgid "Delete the currently selected note or notebook." msgid "Delete the currently selected note or notebook."
msgstr "" msgstr ""
@ -39,28 +51,16 @@ msgstr ""
msgid "[t]oggle note [m]etadata." msgid "[t]oggle note [m]etadata."
msgstr "" msgstr ""
msgid "Enter command line mode" msgid "[M]ake a new [n]ote"
msgstr "" msgstr ""
msgid "Exit command line mode" msgid "[M]ake a new [t]odo"
msgstr "" msgstr ""
msgid "Cancel the current command." msgid "[M]ake a new note[b]ook"
msgstr "" msgstr ""
msgid "Exit the application." msgid "Copy ([Y]ank) the [n]ote to a notebook."
msgstr ""
msgid "Create a [n]ew [n]ote"
msgstr ""
msgid "Create a [n]ew [t]odo"
msgstr ""
msgid "Create a [n]ew [n]otebook"
msgstr ""
msgid "Copy the note to a notebook."
msgstr "" msgstr ""
msgid "Move the note to a notebook." msgid "Move the note to a notebook."
@ -251,6 +251,9 @@ msgstr ""
msgid "Displays usage information." msgid "Displays usage information."
msgstr "" msgstr ""
msgid "Shortcuts are not available in CLI mode."
msgstr ""
msgid "Type `help [command]` for more information about a command." msgid "Type `help [command]` for more information about a command."
msgstr "" msgstr ""

View File

@ -21,6 +21,20 @@ msgstr ""
msgid "Give focus to previous widget" msgid "Give focus to previous widget"
msgstr "" msgstr ""
msgid "Enter command line mode"
msgstr ""
msgid "Exit command line mode"
msgstr ""
#, fuzzy
msgid "Cancel the current command."
msgstr "Annulation..."
#, fuzzy
msgid "Exit the application."
msgstr "Quitter le logiciel."
msgid "Delete the currently selected note or notebook." msgid "Delete the currently selected note or notebook."
msgstr "" msgstr ""
@ -41,34 +55,20 @@ msgstr ""
msgid "[t]oggle note [m]etadata." msgid "[t]oggle note [m]etadata."
msgstr "" msgstr ""
msgid "Enter command line mode"
msgstr ""
msgid "Exit command line mode"
msgstr ""
#, fuzzy #, fuzzy
msgid "Cancel the current command." msgid "[M]ake a new [n]ote"
msgstr "Annulation..."
#, fuzzy
msgid "Exit the application."
msgstr "Quitter le logiciel."
#, fuzzy
msgid "Create a [n]ew [n]ote"
msgstr "Créer une note." msgstr "Créer une note."
#, fuzzy #, fuzzy
msgid "Create a [n]ew [t]odo" msgid "[M]ake a new [t]odo"
msgstr "Créer une nouvelle tâche." msgstr "Créer une nouvelle tâche."
#, fuzzy #, fuzzy
msgid "Create a [n]ew [n]otebook" msgid "[M]ake a new note[b]ook"
msgstr "Créer un carnet." msgstr "Créer un carnet."
#, fuzzy #, fuzzy
msgid "Copy the note to a notebook." msgid "Copy ([Y]ank) the [n]ote to a notebook."
msgstr "Impossible de copier la note dans le carnet \"%s\"" msgstr "Impossible de copier la note dans le carnet \"%s\""
#, fuzzy #, fuzzy
@ -279,6 +279,9 @@ msgstr "Afficher l'URL de l'emplacement de la note."
msgid "Displays usage information." msgid "Displays usage information."
msgstr "Affiche les informations de version" msgstr "Affiche les informations de version"
msgid "Shortcuts are not available in CLI mode."
msgstr ""
msgid "Type `help [command]` for more information about a command." msgid "Type `help [command]` for more information about a command."
msgstr "" msgstr ""
@ -858,6 +861,10 @@ msgstr ""
msgid "Welcome" msgid "Welcome"
msgstr "Bienvenue" msgstr "Bienvenue"
#, fuzzy
#~ msgid "Create a [n]ew [n]otebook"
#~ msgstr "Créer un carnet."
#, fuzzy #, fuzzy
#~ msgid "[Cancel]" #~ msgid "[Cancel]"
#~ msgstr "Annulation..." #~ msgstr "Annulation..."

View File

@ -21,6 +21,18 @@ msgstr ""
msgid "Give focus to previous widget" msgid "Give focus to previous widget"
msgstr "" msgstr ""
msgid "Enter command line mode"
msgstr ""
msgid "Exit command line mode"
msgstr ""
msgid "Cancel the current command."
msgstr ""
msgid "Exit the application."
msgstr ""
msgid "Delete the currently selected note or notebook." msgid "Delete the currently selected note or notebook."
msgstr "" msgstr ""
@ -39,28 +51,16 @@ msgstr ""
msgid "[t]oggle note [m]etadata." msgid "[t]oggle note [m]etadata."
msgstr "" msgstr ""
msgid "Enter command line mode" msgid "[M]ake a new [n]ote"
msgstr "" msgstr ""
msgid "Exit command line mode" msgid "[M]ake a new [t]odo"
msgstr "" msgstr ""
msgid "Cancel the current command." msgid "[M]ake a new note[b]ook"
msgstr "" msgstr ""
msgid "Exit the application." msgid "Copy ([Y]ank) the [n]ote to a notebook."
msgstr ""
msgid "Create a [n]ew [n]ote"
msgstr ""
msgid "Create a [n]ew [t]odo"
msgstr ""
msgid "Create a [n]ew [n]otebook"
msgstr ""
msgid "Copy the note to a notebook."
msgstr "" msgstr ""
msgid "Move the note to a notebook." msgid "Move the note to a notebook."
@ -251,6 +251,9 @@ msgstr ""
msgid "Displays usage information." msgid "Displays usage information."
msgstr "" msgstr ""
msgid "Shortcuts are not available in CLI mode."
msgstr ""
msgid "Type `help [command]` for more information about a command." msgid "Type `help [command]` for more information about a command."
msgstr "" msgstr ""

230
README.md
View File

@ -1,13 +1,23 @@
# Joplin
INTRODUCTION
![Joplin Terminal Screenshot](https://github.com/laurent22/joplin/blob/master/docs/images/ScreenshotTerminal.png)
# Installation # Installation
npm install -g joplin npm install -g joplin
To start it, type `joplin`.
# Demo # Demo
The demo application shows various Wikipedia articles converted to Markdown and organised into notebooks in order to test and demonstrate the application. The demo application and its settings will be installed in a separate directory so as not to interfere with any existing Joplin application. The demo application shows various Wikipedia articles converted to Markdown and organised into notebooks, as well as an example todo list, in order to test and demonstrate the application. The demo application and its settings will be installed in a separate directory so as not to interfere with any existing Joplin application.
npm install -g demo-joplin npm install -g demo-joplin
To start it, type `demo-joplin`.
# Features # Features
- Mobile and command line applications. - Mobile and command line applications.
@ -16,7 +26,7 @@ The demo application shows various Wikipedia articles converted to Markdown and
- Ability to synchronise with multiple targets, including the file system and OneDrive (Dropbox is planned). - Ability to synchronise with multiple targets, including the file system and OneDrive (Dropbox is planned).
- Synchronises to a plain text format, which can be easily manipulated, backed up, or exported to a different format. - Synchronises to a plain text format, which can be easily manipulated, backed up, or exported to a different format.
- Plain text notes, which are rendered as markdown in the mobile application. - Plain text notes, which are rendered as markdown in the mobile application.
- Tag support (currently, tags can be imported from Evernote and modified in the CLI application, but not yet in the mobile one) - Tag support
- File attachment support (likewise, all file attachements can be imported from Evernote but currently cannot be manually added to a note) - File attachment support (likewise, all file attachements can be imported from Evernote but currently cannot be manually added to a note)
- Search functionality. - Search functionality.
- Geolocation support. - Geolocation support.
@ -26,19 +36,17 @@ The demo application shows various Wikipedia articles converted to Markdown and
To start the application type `joplin`. This will open the user interface, which has three main panes: Notebooks, Notes and the text of the current note. There are also additional panels that can be toggled on and off via shortcuts (see shortcuts below). To start the application type `joplin`. This will open the user interface, which has three main panes: Notebooks, Notes and the text of the current note. There are also additional panels that can be toggled on and off via shortcuts (see shortcuts below).
![Joplin Terminal Screenshot](https://github.com/laurent22/joplin/blob/master/docs/images/ScreenshotTerminal.png)
## Input modes ## Input modes
Joplin user interface is partly based on vim and offers two different modes to interact with the notes and notebooks: Joplin user interface is partly based on vim and offers two different modes to interact with the notes and notebooks:
### Normal mode ### Normal mode
Allows moving from one pane to another using the `Tab` and `Shift-Tab` keys, and to select/view notes. Press `Enter` to edit a note. Various other [shortcuts](#shortcuts) are available. Allows moving from one pane to another using the `Tab` and `Shift-Tab` keys, and to select/view notes. Press `Enter` to edit a note. Various other [shortcuts](#available-shortcuts) are available.
### Command-line mode ### Command-line mode
Press `:` to enter the command line mode. From there, all the Joplin comands are available such as `mknote` or `search`. See the [full list of commands](#commands). Press `:` to enter command line mode. From there, the Joplin comands such as `mknote` or `search` are available. See the [full list of commands](#available-commands).
It is possible to refer to a note or notebook by title or ID. However the simplest way is to refer to the currently selected item using one of these shortcuts: It is possible to refer to a note or notebook by title or ID. However the simplest way is to refer to the currently selected item using one of these shortcuts:
@ -48,6 +56,8 @@ Shortcut | Description
`$b` | Refers to the currently selected notebook `$b` | Refers to the currently selected notebook
`$c` | Refers to the currently selected item. For example, if the note list is current active, `$c` will refer to the currently selected note. `$c` | Refers to the currently selected item. For example, if the note list is current active, `$c` will refer to the currently selected note.
**Examples:**
Create a new note with title "Wednesday's meeting": Create a new note with title "Wednesday's meeting":
mknote "Wednesday's meeting" mknote "Wednesday's meeting"
@ -86,17 +96,7 @@ If the help is not fully visible, press `Tab` multiple times till the console is
## Editing a note ## Editing a note
HOW TO EDIT A NOTE To edit a note, select it and press `ENTER`. Or, in command-line, mode type `edit $n` to edit the currently selected note, or `edit "Note title"` to edit a particular note.
# Available commands
PUT LIST OF COMMANDS
# Available keyboard shortcuts
There are two types of shortcuts: those that manipulate the user interface directly, such as TAB to move from one widget to another, and those that are simply shortcuts to actual commands. For example, typing `nn`, which is used to create a new note, will switch to command line mode and pre-fill it with `mknote ""` from where the title of the note can be entered.
PUT LIST OF SHORTCUT
# Importing notes from Evernote # Importing notes from Evernote
@ -118,15 +118,15 @@ LINK TO ANDROID CLIENT
# URLs # URLs
One issue with rendering markdown in a terminal is that URLs often end up looking like this: By pressing Ctrl+Click on a URL, most terminals will open that URL in the default browser. However, one issue especially with long URLs is that they can end up like this:
IMAGE OF WORD WRAP LINK ![Cut URL in terminal](https://github.com/laurent22/joplin/blob/master/docs/images/UrlCut.png)
Not only it makes the text hard to read, but the link, being cut in two, will also not be clickable (in most terminals pressing Ctrl+Click opens the link). Not only it makes the text hard to read, but the link, being cut in two, will also not be clickable.
As a solution Joplin tries to start a mini-server in the background and, if successful, all the links will be converted to a much shorter, local URL. As a solution Joplin tries to start a mini-server in the background and, if successful, all the links will be converted to a much shorter, local URL:
IMAGE OF CONVERTED TEXT ![Converted URL in terminal](https://github.com/laurent22/joplin/blob/master/docs/images/UrlNoCut.png)
With this it means that not only the text will be more readable but links are also unlikely to be cut. Note that both resources (files that are attached to notes) and external links are handled in this way. With this it means that not only the text will be more readable but links are also unlikely to be cut. Note that both resources (files that are attached to notes) and external links are handled in this way.
@ -143,7 +143,191 @@ The applications is currently available in English and French. If you would like
- In Poedit, open this .pot file, go into the Catalog menu and click Configuration. Change "Country" and "Language" to your own country and language. - In Poedit, open this .pot file, go into the Catalog menu and click Configuration. Change "Country" and "Language" to your own country and language.
- From then you can translate the file. Once it's done, please send the file to [this address](https://raw.githubusercontent.com/laurent22/joplin/master/Assets/Adresse.png). - From then you can translate the file. Once it's done, please send the file to [this address](https://raw.githubusercontent.com/laurent22/joplin/master/Assets/Adresse.png).
# Command line mode # Available shortcuts
There are two types of shortcuts: those that manipulate the user interface directly, such as TAB to move from one widget to another, and those that are simply shortcuts to actual commands. In a way similar to Vim, these commands are generally a verb followed by an object. For example, typing `mn` ([m]ake [n]ote), is used to create a new note, it will switch the interface to command line mode and pre-fill it with `mknote ""` from where the title of the note can be entered.
*List of shortcuts:*
Tab Give focus to next widget
Shift+Tab Give focus to previous widget
: Enter command line mode
ESC Exit command line mode
Ctrl+C Cancel the current command.
Ctrl+D Exit the application.
DELETE Delete the currently selected note or notebook.
SPACE Set a todo as completed / not completed
tc [t]oggle [c]onsole between maximized/minimized/hidden/visible.
tm [t]oggle note [m]etadata.
mn [m]ake a new [n]ote
mt [m]ake a new [t]odo
mb [m]ake a new note[b]ook
yn Copy ([y]ank) the [n]ote to a notebook.
dn Move the note to a notebook.
# Available commands
The following commands are available in [command-line mode](#command-line-mode):
attach <note> <file>
Attaches the given file to the note.
config [name] [value]
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.
-v, --verbose Also displays unset and hidden config variables.
Possible keys/values:
editor Text editor.
The editor that will be used to open a note. If
none is provided it will try to auto-detect the
default editor.
Type: string.
locale Language.
Type: Enum.
Possible values: en_GB (English), fr_FR (Français).
Default: "en_GB"
sync.2.path File system synchronisation target directory.
The path to synchronise with when file system
synchronisation is enabled. See `sync.target`.
Type: string.
sync.interval Synchronisation interval.
Type: Enum.
Possible values: 0 (Disabled), 300 (5 minutes), 600
(10 minutes), 1800 (30 minutes), 3600 (1 hour),
43200 (12 hours), 86400 (24 hours).
Default: 300
sync.target Synchronisation target.
The target to synchonise to. If synchronising with
the file system, set `sync.2.path` to specify the
target directory.
Type: Enum.
Possible values: 1 (Memory), 2 (File system), 3
(OneDrive).
Default: 3
trackLocation Save geo-location with notes.
Type: bool.
Default: true
uncompletedTodosOnTop Show uncompleted todos on top of the lists.
Type: bool.
Default: true
cp <note> [notebook]
Duplicates the notes matching <note> to [notebook]. If no notebook is
specified the note is duplicated in the current notebook.
done <note>
Marks a todo as done.
edit <note>
Edit note.
exit
Exits the application.
export <destination>
Exports Joplin data to the given target.
--note <note> Exports only the given note.
--notebook <notebook> Exports only the given notebook.
geoloc <note>
Displays a geolocation URL for the note.
help [command]
Displays usage information.
import-enex <file> [notebook]
Imports an Evernote notebook file (.enex file).
-f, --force Do not ask for confirmation.
mkbook <new-notebook>
Creates a new notebook.
mknote <new-note>
Creates a new note.
mktodo <new-todo>
Creates a new todo.
mv <note> [notebook]
Moves the notes matching <note> to [notebook].
ren <item> <name>
Renames the given <item> (note or notebook) to <name>.
rmbook <notebook>
Deletes the given notebook.
-f, --force Deletes the notebook without asking for confirmation.
rmnote <note-pattern>
Deletes the notes matching <note-pattern>.
-f, --force Deletes the notes without asking for confirmation.
search <pattern> [notebook]
Searches for the given <pattern> in all the notes.
status
Displays summary about the notes and notebooks.
sync
Synchronises with remote storage.
--target <target> Sync to provided target (defaults to sync.target config
value)
tag <tag-command> [tag] [note]
<tag-command> can be "add", "remove" or "list" to assign or remove [tag]
from [note], or to list the notes associated with [tag]. The command `tag
list` can be used to list all the tags.
todo <todo-command> <note-pattern>
<todo-command> can either be "toggle" or "clear". Use "toggle" to toggle
the given todo between completed and uncompleted state (If the target is a
regular note it will be converted to a todo). Use "clear" to convert the
todo back to a regular note.
undone <note>
Marks a todo as non-completed.
version
Displays version information
# License # License

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

BIN
docs/images/UrlCut.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
docs/images/UrlNoCut.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB