mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-14 00:42:27 +01:00
Add guid command
This commit is contained in:
@@ -54,6 +54,7 @@
|
|||||||
"body-parser": "^1.15.2",
|
"body-parser": "^1.15.2",
|
||||||
"loglevel": "^1.4.1",
|
"loglevel": "^1.4.1",
|
||||||
"react": "^15.4.0",
|
"react": "^15.4.0",
|
||||||
"react-dom": "^15.4.0"
|
"react-dom": "^15.4.0",
|
||||||
|
"uuid": "^3.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ import UnknownCommandResult from './models/UnknownCommandResult';
|
|||||||
import ExpressionResult from './models/ExpressionResult';
|
import ExpressionResult from './models/ExpressionResult';
|
||||||
import ErrorResult from './models/ErrorResult';
|
import ErrorResult from './models/ErrorResult';
|
||||||
import WahtsnewResult from './models/WhatsnewResult';
|
import WahtsnewResult from './models/WhatsnewResult';
|
||||||
|
import StringResult from './models/StringResult';
|
||||||
import * as expression from './expression';
|
import * as expression from './expression';
|
||||||
|
import uuid from 'uuid/v4';
|
||||||
|
|
||||||
|
console.log(uuid);
|
||||||
|
|
||||||
var cmdConfig = {};
|
var cmdConfig = {};
|
||||||
|
|
||||||
@@ -36,6 +40,9 @@ export default {
|
|||||||
'whatsnew': function(c) {
|
'whatsnew': function(c) {
|
||||||
appState.addCommandResult(new WahtsnewResult(c.input));
|
appState.addCommandResult(new WahtsnewResult(c.input));
|
||||||
},
|
},
|
||||||
|
'guid': function(c) {
|
||||||
|
appState.addCommandResult(new StringResult(c.input, uuid()))
|
||||||
|
},
|
||||||
'-notrack': function () {},
|
'-notrack': function () {},
|
||||||
'-debug': function() {
|
'-debug': function() {
|
||||||
console.log('Debug mode on')
|
console.log('Debug mode on')
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import BitwiseOperationExpressionView from './results/BitwiseOperationExpression
|
|||||||
import WhatsnewResult from '../models/WhatsnewResult';
|
import WhatsnewResult from '../models/WhatsnewResult';
|
||||||
import WhatsnewResultView from './results/WhatsnewResultView';
|
import WhatsnewResultView from './results/WhatsnewResultView';
|
||||||
import ErrorResult from '../models/ErrorResult';
|
import ErrorResult from '../models/ErrorResult';
|
||||||
|
import StringResult from '../models/StringResult';
|
||||||
|
|
||||||
import * as expression from '../expression';
|
import * as expression from '../expression';
|
||||||
|
|
||||||
export default class DisplayResult extends React.Component {
|
export default class DisplayResult extends React.Component {
|
||||||
@@ -39,6 +41,10 @@ export default class DisplayResult extends React.Component {
|
|||||||
return <WhatsnewResultView />
|
return <WhatsnewResultView />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(result instanceof StringResult) {
|
||||||
|
return <p>{result.value}</p>
|
||||||
|
}
|
||||||
|
|
||||||
if (result instanceof ErrorResult) {
|
if (result instanceof ErrorResult) {
|
||||||
return <div className="result">
|
return <div className="result">
|
||||||
<div className="error">(X_X) Ooops.. Something ain' right: <strong>{result.error.message}</strong></div>
|
<div className="error">(X_X) Ooops.. Something ain' right: <strong>{result.error.message}</strong></div>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export default class HelpResultView extends React.Component {
|
|||||||
<li><code><CommandLink text="dark" /></code> — set Light theme</li>
|
<li><code><CommandLink text="dark" /></code> — set Light theme</li>
|
||||||
<li><code><CommandLink text="midnight" /></code> — set Midnight theme</li>
|
<li><code><CommandLink text="midnight" /></code> — set Midnight theme</li>
|
||||||
<li><code><CommandLink text="about" /></code> — about the app</li>
|
<li><code><CommandLink text="about" /></code> — about the app</li>
|
||||||
|
<li><code><CommandLink text="guid" /></code> — generate <a href="https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29">v4</a> GUID</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
8
src/app/models/StringResult.js
Normal file
8
src/app/models/StringResult.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import CommandResult from './CommandResult';
|
||||||
|
|
||||||
|
export default class StringResult extends CommandResult {
|
||||||
|
constructor(input, text) {
|
||||||
|
super(input);
|
||||||
|
this.value = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user