aaden-cli 1.1.113 → 1.1.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +31 -1
  2. package/index.js +30 -0
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18248,7 +18248,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
18248
18248
  /***/ ((module) => {
18249
18249
 
18250
18250
  "use strict";
18251
- module.exports = {"i8":"1.1.112"};
18251
+ module.exports = {"i8":"1.1.113"};
18252
18252
 
18253
18253
  /***/ }),
18254
18254
 
@@ -18465,6 +18465,12 @@ program.command('db').action(enterDatabase)
18465
18465
  program.command('printer-test').action(testPrinter)
18466
18466
  program.command('enable-mile-pay').action(enableMilePay)
18467
18467
  program.command('start-mile-pay').action(startService)
18468
+ program.command('mile-pay-option')
18469
+ .option('-k, --access-key <accessKey>')
18470
+ .option('-s, --access-secret <accessSecret>')
18471
+ .option('-m, --merchant-no <merchantNo>')
18472
+ .action(milePayOption)
18473
+
18468
18474
 
18469
18475
  if (program.debug) {
18470
18476
  debugInfo()
@@ -18983,6 +18989,30 @@ async function startService () {
18983
18989
  ], program.debug)
18984
18990
  }
18985
18991
 
18992
+ async function milePayOption (options) {
18993
+ const operations = {
18994
+ accessKey: (accessKey, res) => res.replace(/access-key: +[a-zA-Z0-9]+/g, 'access-key: ' + accessKey),
18995
+ accessSecret: (accessSecret, res) => res.replace(/access-secret: +[a-zA-Z0-9]+/g, 'access-secret: ' + accessSecret),
18996
+ merchantNo: (merchantNo, res) => res.replace(/merchant-no: +\d+/g, 'merchant-no: ' + merchantNo)
18997
+ }
18998
+
18999
+ Object.entries(operations).forEach(entry => {
19000
+ const [key, value] = entry
19001
+ const newValue = options[key]
19002
+ if (newValue !== undefined) {
19003
+ editMilePaySettings(newValue, value)
19004
+ console.log(`${key} 已变更为 ${newValue}`)
19005
+ }
19006
+ })
19007
+ }
19008
+
19009
+ function editMilePaySettings (newValue, transform) {
19010
+ const filePath = '/home/aaden/biomace/application.yml'
19011
+ const res = fs.readFileSync(filePath).toString()
19012
+ const out = transform(res, newValue)
19013
+ fs.writeFileSync(filePath, out)
19014
+ }
19015
+
18986
19016
  function returnTerminal () {
18987
19017
 
18988
19018
  }
package/index.js CHANGED
@@ -53,6 +53,12 @@ program.command('db').action(enterDatabase)
53
53
  program.command('printer-test').action(testPrinter)
54
54
  program.command('enable-mile-pay').action(enableMilePay)
55
55
  program.command('start-mile-pay').action(startService)
56
+ program.command('mile-pay-option')
57
+ .option('-k, --access-key <accessKey>')
58
+ .option('-s, --access-secret <accessSecret>')
59
+ .option('-m, --merchant-no <merchantNo>')
60
+ .action(milePayOption)
61
+
56
62
 
57
63
  if (program.debug) {
58
64
  debugInfo()
@@ -571,6 +577,30 @@ async function startService () {
571
577
  ], program.debug)
572
578
  }
573
579
 
580
+ async function milePayOption (options) {
581
+ const operations = {
582
+ accessKey: (accessKey, res) => res.replace(/access-key: +[a-zA-Z0-9]+/g, 'access-key: ' + accessKey),
583
+ accessSecret: (accessSecret, res) => res.replace(/access-secret: +[a-zA-Z0-9]+/g, 'access-secret: ' + accessSecret),
584
+ merchantNo: (merchantNo, res) => res.replace(/merchant-no: +\d+/g, 'merchant-no: ' + merchantNo)
585
+ }
586
+
587
+ Object.entries(operations).forEach(entry => {
588
+ const [key, value] = entry
589
+ const newValue = options[key]
590
+ if (newValue !== undefined) {
591
+ editMilePaySettings(newValue, value)
592
+ console.log(`${key} 已变更为 ${newValue}`)
593
+ }
594
+ })
595
+ }
596
+
597
+ function editMilePaySettings (newValue, transform) {
598
+ const filePath = '/home/aaden/biomace/application.yml'
599
+ const res = fs.readFileSync(filePath).toString()
600
+ const out = transform(res, newValue)
601
+ fs.writeFileSync(filePath, out)
602
+ }
603
+
574
604
  function returnTerminal () {
575
605
 
576
606
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaden-cli",
3
- "version": "1.1.113",
3
+ "version": "1.1.114",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {