mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Cli: Fixed version command so that it does not require the keychain
This commit is contained in:
parent
8108af4e74
commit
15766d18f5
@ -402,8 +402,16 @@ class Application extends BaseApplication {
|
||||
}
|
||||
}
|
||||
|
||||
// We need this special case here because by the time the `version` command
|
||||
// runs, the keychain has already been setup.
|
||||
checkIfKeychainEnabled(argv) {
|
||||
return argv.indexOf('version') < 0;
|
||||
}
|
||||
|
||||
async start(argv) {
|
||||
argv = await super.start(argv);
|
||||
const keychainEnabled = this.checkIfKeychainEnabled(argv);
|
||||
|
||||
argv = await super.start(argv, { keychainEnabled });
|
||||
|
||||
cliUtils.setStdout(object => {
|
||||
return this.stdout(object);
|
||||
|
@ -1,6 +1,6 @@
|
||||
const { BaseCommand } = require('./base-command.js');
|
||||
const Setting = require('@joplin/lib/models/Setting').default;
|
||||
const { _ } = require('@joplin/lib/locale');
|
||||
const versionInfo = require('@joplin/lib/versionInfo').default;
|
||||
|
||||
class Command extends BaseCommand {
|
||||
usage() {
|
||||
@ -12,8 +12,7 @@ class Command extends BaseCommand {
|
||||
}
|
||||
|
||||
async action() {
|
||||
const p = require('./package.json');
|
||||
this.stdout(_('%s %s (%s)', p.name, p.version, Setting.value('env')));
|
||||
this.stdout(versionInfo(require('./package.json')).message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import shim from './shim';
|
||||
import BaseService from './services/BaseService';
|
||||
import reducer, { setStore } from './reducer';
|
||||
import KeychainServiceDriver from './services/keychain/KeychainServiceDriver.node';
|
||||
import KeychainServiceDriverDummy from './services/keychain/KeychainServiceDriver.dummy';
|
||||
import { _, setLocale } from './locale';
|
||||
import KvStore from './services/KvStore';
|
||||
import SyncTargetJoplinServer from './SyncTargetJoplinServer';
|
||||
@ -55,6 +56,10 @@ const appLogger: LoggerWrapper = Logger.create('App');
|
||||
// const ntpClient = require('./vendor/ntp-client');
|
||||
// ntpClient.dgram = require('dgram');
|
||||
|
||||
interface StartOptions {
|
||||
keychainEnabled?: boolean;
|
||||
}
|
||||
|
||||
export default class BaseApplication {
|
||||
|
||||
private eventEmitter_: any;
|
||||
@ -655,7 +660,12 @@ export default class BaseApplication {
|
||||
return toSystemSlashes(output, 'linux');
|
||||
}
|
||||
|
||||
async start(argv: string[]): Promise<any> {
|
||||
async start(argv: string[], options: StartOptions = null): Promise<any> {
|
||||
options = {
|
||||
keychainEnabled: true,
|
||||
...options,
|
||||
};
|
||||
|
||||
const startFlags = await this.handleStartFlags_(argv);
|
||||
|
||||
argv = startFlags.argv;
|
||||
@ -744,7 +754,7 @@ export default class BaseApplication {
|
||||
reg.setDb(this.database_);
|
||||
BaseModel.setDb(this.database_);
|
||||
|
||||
await loadKeychainServiceAndSettings(KeychainServiceDriver);
|
||||
await loadKeychainServiceAndSettings(options.keychainEnabled ? KeychainServiceDriver : KeychainServiceDriverDummy);
|
||||
await handleSyncStartupOperation();
|
||||
|
||||
appLogger.info(`Client ID: ${Setting.value('clientId')}`);
|
||||
|
Loading…
Reference in New Issue
Block a user