aaden-cli 1.2.24 → 1.2.25

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.
File without changes
File without changes
File without changes
package/dist/index.js CHANGED
@@ -58161,7 +58161,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
58161
58161
  /***/ ((module) => {
58162
58162
 
58163
58163
  "use strict";
58164
- module.exports = {"i8":"1.2.23"};
58164
+ module.exports = {"i8":"1.2.24"};
58165
58165
 
58166
58166
  /***/ }),
58167
58167
 
@@ -58450,6 +58450,14 @@ program.command('enable-resource-track').action(enableResourceTrack)
58450
58450
  program.command('start-resource-track').action(startResourceTrack)
58451
58451
  program.command('auto-send-mail').action(editIni)
58452
58452
  program.command('auto-send-summary').action(autoSendSummaryLastMonth)
58453
+ program.command('set-do-not-send-zbon-when-print-true').
58454
+ action(editConfigIni(setConfig('Email', 'DoNotSendZbonWhenPrint', true)))
58455
+ program.command('set-do-not-send-zbon-when-print-false').
58456
+ action(editConfigIni(setConfig('Email', 'DoNotSendZbonWhenPrint', false)))
58457
+ program.command('set-auto-send-3in1-today-true').
58458
+ action(editConfigIni(setConfig('Email', 'AutoSend3in1Today', true)))
58459
+ program.command('set-auto-send-3in1-today-false').
58460
+ action(editConfigIni(setConfig('Email', 'AutoSend3in1Today', false)))
58453
58461
 
58454
58462
  if (program.debug) {
58455
58463
  debugInfo()
@@ -59073,18 +59081,13 @@ function editIni () {
59073
59081
  cli.executeInShell([
59074
59082
  'sudo chmod 777 /var/www/html/Resource/config/config.ini',
59075
59083
  'aaden-cli fix-cronjob',
59076
- ],program.debug)
59077
- const ini = __nccwpck_require__(80045)
59078
- const filePath = '/var/www/html/Resource/config/config.ini'
59079
- const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
59080
- console.log(info)
59081
- if(!info.Email) {
59082
- info.Email = {}
59083
- }
59084
- info.Email.AutoSend3in1LastMonth = true
59085
-
59086
- fs.writeFileSync(filePath, ini.stringify(info))
59084
+ ], program.debug)
59087
59085
 
59086
+ editConfigIni(composeMany([
59087
+ setConfig('Email', 'AutoSend3in1LastMonth', true),
59088
+ setConfig('Email', 'DoNotSendZbonWhenPrint', true),
59089
+ setConfig('Email', 'AutoSend3in1Today', false),
59090
+ ]))()
59088
59091
  }
59089
59092
 
59090
59093
  function autoSendSummaryLastMonth () {
@@ -59092,17 +59095,32 @@ function autoSendSummaryLastMonth () {
59092
59095
  'sudo chmod 777 /var/www/html/Resource/config/config.ini',
59093
59096
  'aaden-cli fix-cronjob',
59094
59097
  ], program.debug)
59095
- const ini = __nccwpck_require__(80045)
59096
- const filePath = '/var/www/html/Resource/config/config.ini'
59097
- const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
59098
- console.log(info)
59099
- if (!info.Email) {
59100
- info.Email = {}
59098
+
59099
+ editConfigIni(setConfig('Email', 'AutoSendSummaryLastMonth', true))()
59100
+ }
59101
+
59102
+ function editConfigIni (f) {
59103
+ return () => {
59104
+ const ini = __nccwpck_require__(80045)
59105
+ const filePath = '/var/www/html/Resource/config/config.ini'
59106
+ const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
59107
+ f(info)
59108
+ fs.writeFileSync(filePath, ini.stringify(info))
59101
59109
  }
59102
- info.Email.AutoSendSummaryLastMonth = true
59110
+ }
59103
59111
 
59104
- fs.writeFileSync(filePath, ini.stringify(info))
59112
+ function setConfig (section, key, value) {
59113
+ return file => {
59114
+ if (!file[section]) {
59115
+ file[section] = {}
59116
+ }
59117
+ file[section][key] = value
59118
+ return file
59119
+ }
59120
+ }
59105
59121
 
59122
+ function composeMany (fs) {
59123
+ return fs.reduce((f, g) => x => g(f(x)), x => x)
59106
59124
  }
59107
59125
 
59108
59126
  function getPrivilegeCMD (path, pri = '+x', relativePath = true) {
package/index.js CHANGED
@@ -69,6 +69,14 @@ program.command('enable-resource-track').action(enableResourceTrack)
69
69
  program.command('start-resource-track').action(startResourceTrack)
70
70
  program.command('auto-send-mail').action(editIni)
71
71
  program.command('auto-send-summary').action(autoSendSummaryLastMonth)
72
+ program.command('set-do-not-send-zbon-when-print-true').
73
+ action(editConfigIni(setConfig('Email', 'DoNotSendZbonWhenPrint', true)))
74
+ program.command('set-do-not-send-zbon-when-print-false').
75
+ action(editConfigIni(setConfig('Email', 'DoNotSendZbonWhenPrint', false)))
76
+ program.command('set-auto-send-3in1-today-true').
77
+ action(editConfigIni(setConfig('Email', 'AutoSend3in1Today', true)))
78
+ program.command('set-auto-send-3in1-today-false').
79
+ action(editConfigIni(setConfig('Email', 'AutoSend3in1Today', false)))
72
80
 
73
81
  if (program.debug) {
74
82
  debugInfo()
@@ -692,18 +700,13 @@ function editIni () {
692
700
  cli.executeInShell([
693
701
  'sudo chmod 777 /var/www/html/Resource/config/config.ini',
694
702
  'aaden-cli fix-cronjob',
695
- ],program.debug)
696
- const ini = require("ini")
697
- const filePath = '/var/www/html/Resource/config/config.ini'
698
- const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
699
- console.log(info)
700
- if(!info.Email) {
701
- info.Email = {}
702
- }
703
- info.Email.AutoSend3in1LastMonth = true
704
-
705
- fs.writeFileSync(filePath, ini.stringify(info))
703
+ ], program.debug)
706
704
 
705
+ editConfigIni(composeMany([
706
+ setConfig('Email', 'AutoSend3in1LastMonth', true),
707
+ setConfig('Email', 'DoNotSendZbonWhenPrint', true),
708
+ setConfig('Email', 'AutoSend3in1Today', false),
709
+ ]))()
707
710
  }
708
711
 
709
712
  function autoSendSummaryLastMonth () {
@@ -711,17 +714,32 @@ function autoSendSummaryLastMonth () {
711
714
  'sudo chmod 777 /var/www/html/Resource/config/config.ini',
712
715
  'aaden-cli fix-cronjob',
713
716
  ], program.debug)
714
- const ini = require("ini")
715
- const filePath = '/var/www/html/Resource/config/config.ini'
716
- const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
717
- console.log(info)
718
- if (!info.Email) {
719
- info.Email = {}
717
+
718
+ editConfigIni(setConfig('Email', 'AutoSendSummaryLastMonth', true))()
719
+ }
720
+
721
+ function editConfigIni (f) {
722
+ return () => {
723
+ const ini = require('ini')
724
+ const filePath = '/var/www/html/Resource/config/config.ini'
725
+ const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
726
+ f(info)
727
+ fs.writeFileSync(filePath, ini.stringify(info))
720
728
  }
721
- info.Email.AutoSendSummaryLastMonth = true
729
+ }
722
730
 
723
- fs.writeFileSync(filePath, ini.stringify(info))
731
+ function setConfig (section, key, value) {
732
+ return file => {
733
+ if (!file[section]) {
734
+ file[section] = {}
735
+ }
736
+ file[section][key] = value
737
+ return file
738
+ }
739
+ }
724
740
 
741
+ function composeMany (fs) {
742
+ return fs.reduce((f, g) => x => g(f(x)), x => x)
725
743
  }
726
744
 
727
745
  function getPrivilegeCMD (path, pri = '+x', relativePath = true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaden-cli",
3
- "version": "1.2.24",
3
+ "version": "1.2.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {