Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
RocketChat
Rocket.Chat.Apps-cli
Commits
bc39036e
Unverified
Commit
bc39036e
authored
Oct 01, 2019
by
Bradley Hilton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prettify the prompts and waitings
parent
dfd63284
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
19 deletions
+8
-19
src/commands/login.ts
src/commands/login.ts
+5
-4
src/commands/submit.ts
src/commands/submit.ts
+3
-15
No files found.
src/commands/login.ts
View file @
bc39036e
...
...
@@ -18,15 +18,16 @@ export default class Login extends Command {
const
cloudAuth
=
new
CloudAuth
();
const
hasToken
=
await
cloudAuth
.
hasToken
();
if
(
hasToken
)
{
cli
.
action
.
start
(
chalk
.
green
(
'
verifying
'
)
+
'
your token...
'
);
await
cloudAuth
.
getToken
();
cli
.
log
(
chalk
.
green
(
'
you are already logged in!
'
));
cli
.
action
.
stop
(
chalk
.
green
(
'
success,
you are already logged in!
'
));
}
else
{
try
{
cli
.
log
(
chalk
.
green
(
'
*
'
)
+
'
'
+
chalk
.
gray
(
'
waiting for authorization...
'
)
)
;
cli
.
action
.
start
(
chalk
.
green
(
'
waiting
'
)
+
'
for authorization...
'
);
await
cloudAuth
.
executeAuthFlow
();
cli
.
action
.
stop
(
'
success!
'
);
cli
.
action
.
stop
(
chalk
.
green
(
'
success!
'
)
)
;
}
catch
(
e
)
{
cli
.
action
.
stop
(
'
fail
ur
e to authenticate.
'
);
cli
.
action
.
stop
(
chalk
.
red
(
'
faile
d
to authenticate.
'
)
)
;
return
;
}
}
...
...
src/commands/submit.ts
View file @
bc39036e
...
...
@@ -64,19 +64,6 @@ export default class Submit extends Command {
//#endregion
//#region asking for information
/*
const result = await inquirer.prompt([{
type: 'input',
name: 'email',
message: 'What is the publisher\'s email address?',
validate: (answer: string) => {
const regex = /^[^@\s]+@[^@\s]+\.[^@\s]+$/g;
return regex.test(answer);
},
}]);
*/
const
cloudAuth
=
new
CloudAuth
();
const
hasToken
=
await
cloudAuth
.
hasToken
();
let
email
=
''
;
...
...
@@ -90,10 +77,11 @@ export default class Submit extends Command {
if
(
cloudAccount
.
hasAccount
)
{
try
{
cli
.
log
(
chalk
.
green
(
'
*
'
)
+
'
'
+
chalk
.
gray
(
'
waiting for authorization...
'
));
cli
.
action
.
start
(
chalk
.
green
(
'
*
'
)
+
'
'
+
chalk
.
gray
(
'
waiting for authorization...
'
));
await
cloudAuth
.
executeAuthFlow
();
cli
.
action
.
stop
(
chalk
.
green
(
'
success!
'
));
}
catch
(
e
)
{
cli
.
action
.
stop
(
'
fail
ur
e to authenticate.
'
);
cli
.
action
.
stop
(
chalk
.
red
(
'
faile
d
to authenticate.
'
)
)
;
return
;
}
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment