Skip to content

Commit

Permalink
chore: 🤖 Add Help subcommand for auth subcommands #36 (#37)
Browse files Browse the repository at this point in the history
## Why?

The Auth subcommands should display detailed information to utilize any
flags and options.

## How?

- Declare each subcommand to include the help command

## Tickets?

-
[PLAT-1511](https://linear.app/fleekxyz/issue/PLAT-1511/add-help-to-auth-subcommand)

## Contribution checklist?

- [x] The commit messages are detailed
- [x] The `build` command runs locally
- [ ] Assets or static content are linked and stored in the project
- [ ] You have manually tested
- [ ] You have provided tests

## Security checklist?

- [ ] Sensitive data has been identified and is being protected properly
- [ ] Injection has been prevented (parameterized queries, no eval or
system calls)

## Preview?

> Login

<img width="812" alt="Screenshot 2024-09-19 at 16 37 24"
src="https://github.com/user-attachments/assets/92e2ea55-b754-476c-a1cc-32fba80788d9">

> Logout

<img width="812" alt="Screenshot 2024-09-19 at 16 37 01"
src="https://github.com/user-attachments/assets/6919387c-c696-4320-a3e3-8581e527d560">
  • Loading branch information
heldrida authored Sep 19, 2024
1 parent 5f86efa commit 3f5f307
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,7 @@
"unexpectedFileFormat": "We weren't expecting the format {format}. Kindly submit a detailed report of the issue to our support team.",
"failedCalculateBlake3Hash": "Failed to calculate the Blake3 hash. Please try again!",
"failedDeployFleekFunction": "Failed to deploy the Fleek Function. Please try again!",
"warnProvideValidDomainName": "Please provide a valid domain name."
"warnProvideValidDomainName": "Please provide a valid domain name.",
"cmdAuthLoginDescription": "Authenticate the CLI session using the Fleek Platform Web app. Open the URL in your favourite browser to initiate the browser-based login process. Select your preferred authentication method and return to CLI once completed.",
"cmdAuthLogoutDescription": "Ends your active CLI session, securing your account. Disables access to personal features such as storage and site deployment until re-authentication."
}
16 changes: 9 additions & 7 deletions src/commands/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { t } from '../../utils/translation';
import { loginActionHandler } from './login';
import { logoutActionHandler } from './logout';

export default (program: Command) => {
program
export default (cmd: Command) => {
cmd
.command('login')
.description(t('loginToFlkPlt', { status: t('loginTo') }))
.description(t('cmdAuthLoginDescription'))
.action(() => {
const uiAppUrl = getDefined('UI__APP_URL');
const authApiUrl = getDefined('SDK__GRAPHQL_API_URL');
Expand All @@ -22,10 +22,12 @@ export default (program: Command) => {
uiAppUrl,
authApiUrl,
});
});
})
.addHelpCommand();

program
cmd
.command('logout')
.description(t('loginToFlkPlt', { status: t('logoutOf') }))
.action(logoutActionHandler);
.description(t('cmdAuthLogoutDescription'))
.action(logoutActionHandler)
.addHelpCommand();
};

0 comments on commit 3f5f307

Please sign in to comment.