1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/CliClient/app/command-geoloc.js

31 lines
722 B
JavaScript
Raw Normal View History

const { BaseCommand } = require('./base-command.js');
const { app } = require('./app.js');
const { _ } = require('lib/locale.js');
2017-12-14 20:12:14 +02:00
const BaseModel = require('lib/BaseModel.js');
const Note = require('lib/models/Note.js');
2017-07-18 21:27:10 +02:00
class Command extends BaseCommand {
usage() {
2017-08-04 18:02:43 +02:00
return 'geoloc <note>';
2017-07-18 21:27:10 +02:00
}
description() {
return _('Displays a geolocation URL for the note.');
}
async action(args) {
const title = args['note'];
2017-07-18 21:27:10 +02:00
const item = await app().loadItem(BaseModel.TYPE_NOTE, title, { parent: app().currentFolder() });
2017-07-18 21:27:10 +02:00
if (!item) throw new Error(_('Cannot find "%s".', title));
const url = Note.geolocationUrl(item);
2017-10-07 18:30:27 +02:00
this.stdout(url);
app()
.gui()
.showConsole();
2017-07-18 21:27:10 +02:00
}
}
module.exports = Command;