@cyklang/cli 0.2.3 → 0.3.1
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.
- package/build/AssetCommand.js +41 -15
- package/build/Cmd.d.ts +2 -2
- package/build/Cmd.js +14 -18
- package/build/DBClient.d.ts +1 -0
- package/build/DBClient.js +4 -0
- package/build/ModuleCommand.js +2 -2
- package/build/QueryCommand.js +49 -39
- package/build/RunCommand.js +21 -28
- package/build/TableCommand.js +8 -8
- package/build/TestCommand.js +20 -1
- package/build/UserCommand.js +12 -5
- package/package.json +3 -5
- package/src/AssetCommand.ts +48 -17
- package/src/Cmd.ts +20 -22
- package/src/DBClient.ts +8 -0
- package/src/ModuleCommand.ts +2 -2
- package/src/QueryCommand.ts +56 -39
- package/src/RunCommand.ts +33 -39
- package/src/TableCommand.ts +8 -8
- package/src/TestCommand.ts +27 -2
- package/src/UserCommand.ts +12 -5
- package/test/cyklang.xsd +870 -219
- package/test/t0.output +1 -1
- package/test/t0.xml +1 -1
- package/test/t01.output +16 -2
- package/test/t01.xml +46 -8
- package/test/t0__us.output +4 -0
- package/test/t0__us.xml +7 -0
- package/test/t1.ts +8 -0
- package/test/t20.xml +16 -0
- package/test/t21.output +2 -0
- package/test/t21.xml +31 -7
- package/test/t23.output +0 -44
- package/test/t23.xml +1 -1
- package/test/t26.output +5 -0
- package/test/t26.xml +35 -0
package/src/UserCommand.ts
CHANGED
|
@@ -11,7 +11,8 @@ export class UserCommand extends Command {
|
|
|
11
11
|
constructor(name: string) {
|
|
12
12
|
super(name)
|
|
13
13
|
this.description('manage users in cyk_user table').version('0.1')
|
|
14
|
-
this.addCommand(new UserAddCmd())
|
|
14
|
+
this.addCommand(new UserAddCmd('add', 'add a new user'))
|
|
15
|
+
this.addCommand(new UserAddCmd('a', 'add a new user'))
|
|
15
16
|
this.addCommand(new UserUpdateCmd('update', 'update user by id all fields except password'))
|
|
16
17
|
this.addCommand(new UserUpdateCmd('u', 'shortcut for (u)pdate'))
|
|
17
18
|
this.addCommand(new UserDeleteCmd('delete', 'delete user by id and name. Both options are mandatory to avoid typing error'))
|
|
@@ -31,18 +32,20 @@ interface Options {
|
|
|
31
32
|
disable: boolean | undefined
|
|
32
33
|
env: string | undefined
|
|
33
34
|
sort: string | undefined
|
|
35
|
+
lang: string | undefined
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
class UserAddCmd extends Cmd {
|
|
37
|
-
constructor() {
|
|
38
|
-
super(
|
|
39
|
-
this.description(
|
|
39
|
+
constructor(name: string, description: string) {
|
|
40
|
+
super(name)
|
|
41
|
+
this.description(description)
|
|
40
42
|
.requiredOption('-n --name <name>', 'user name')
|
|
41
43
|
.option('-e --email <email>', 'user email address')
|
|
42
44
|
.option('-p --passwd <password>', 'initial password')
|
|
43
45
|
.option('-a --access <acl>', 'access control list')
|
|
44
46
|
.option('-m --module <module_name>', 'module to launch by default')
|
|
45
47
|
.option('-d --disable', 'user not abled to connect')
|
|
48
|
+
.option('-l --lang <language>', 'user language')
|
|
46
49
|
.action(async (options: Options) => {
|
|
47
50
|
const dbUser = new DBUser()
|
|
48
51
|
dbUser.name = options.name
|
|
@@ -51,6 +54,7 @@ class UserAddCmd extends Cmd {
|
|
|
51
54
|
dbUser.access = options.access
|
|
52
55
|
dbUser.appli = options.module
|
|
53
56
|
dbUser.disable = options.disable || false
|
|
57
|
+
dbUser.lang = options.lang
|
|
54
58
|
await this.commandAdd(dbUser, options)
|
|
55
59
|
})
|
|
56
60
|
}
|
|
@@ -83,7 +87,7 @@ class UserListCmd extends Cmd {
|
|
|
83
87
|
|
|
84
88
|
const dbClient = new DBClient(this.dbManager)
|
|
85
89
|
dbClient.selectFromTable('List of users', 'cyk_user',
|
|
86
|
-
{ fields: 'user_id,user_name,user_email,user_access,user_appli,user_disable', sort: options.sort || '1' })
|
|
90
|
+
{ fields: 'user_id,user_name,user_email,user_access,user_appli,user_lang,user_disable', sort: options.sort || '1' })
|
|
87
91
|
|
|
88
92
|
}
|
|
89
93
|
catch (err) {
|
|
@@ -102,6 +106,7 @@ class UserUpdateCmd extends Cmd {
|
|
|
102
106
|
.option('-e --email <email>', 'user email address')
|
|
103
107
|
.option('-a --access <acl>', 'access control list')
|
|
104
108
|
.option('-m --module <module_name>', 'module to launch by default')
|
|
109
|
+
.option('-l --lang <language>', 'user language')
|
|
105
110
|
.option('-d --disable', 'user not able to connect')
|
|
106
111
|
.action(async (options: Options) => {
|
|
107
112
|
const dbUser = new DBUser()
|
|
@@ -110,6 +115,7 @@ class UserUpdateCmd extends Cmd {
|
|
|
110
115
|
dbUser.email = options.email
|
|
111
116
|
dbUser.access = options.access
|
|
112
117
|
dbUser.appli = options.module
|
|
118
|
+
dbUser.lang = options.lang
|
|
113
119
|
dbUser.disable = options.disable
|
|
114
120
|
await this.commandUpdate(dbUser, options)
|
|
115
121
|
})
|
|
@@ -126,6 +132,7 @@ class UserUpdateCmd extends Cmd {
|
|
|
126
132
|
if (dbUser2.email !== undefined) dbUser1.email = dbUser2.email
|
|
127
133
|
if (dbUser2.access !== undefined) dbUser1.access = dbUser2.access
|
|
128
134
|
if (dbUser2.appli !== undefined) dbUser1.appli = dbUser2.appli
|
|
135
|
+
if (dbUser2.lang !== undefined) dbUser1.lang = dbUser2.lang
|
|
129
136
|
if (dbUser2.disable !== undefined) dbUser1.disable = dbUser2.disable
|
|
130
137
|
// logger.debug('dbUser1 before dbUserUpdate : ', dbUser1)
|
|
131
138
|
await this.dbManager.dbUserUpdate(dbUser1)
|