Skip to content

Commit

Permalink
feat(cli): add possibility to insert AT after running scanner if the …
Browse files Browse the repository at this point in the history
…AT was not provided.
  • Loading branch information
adelkahomolova committed Aug 25, 2019
1 parent b5d3d99 commit 47353dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"node-filter-async": "^1.1.3",
"npm-check-updates": "^3.1.21",
"oclif": "^1.13.5",
"readline-promise": "^1.0.4",
"reflect-metadata": "^0.1.13",
"semver": "^6.3.0",
"simple-git": "^1.124.0",
Expand Down
5 changes: 5 additions & 0 deletions src/detectors/ScanningStrategyDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { injectable, inject } from 'inversify';
import { ErrorFactory } from '../lib/errors';
import { Types } from '../types';
import { ArgumentsProvider } from '../inversify.config';
import cli from 'cli-ux';

@injectable()
export class ScanningStrategyDetector implements IDetector<string, ScanningStrategy> {
Expand Down Expand Up @@ -42,6 +43,10 @@ export class ScanningStrategyDetector implements IDetector<string, ScanningStrat
accessType = await this.determineRemoteAccessType({ remoteUrl: path, serviceType });
}

if (accessType === AccessType.private) {
this.argumentsProvider.auth = await cli.prompt('Insert your GitHub personal access token.\nhttps://github.com/settings/tokens\n');
}

return {
serviceType,
accessType,
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7054,6 +7054,11 @@ readdir-scoped-modules@^1.0.0, readdir-scoped-modules@^1.1.0:
graceful-fs "^4.1.2"
once "^1.3.0"

readline-promise@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/readline-promise/-/readline-promise-1.0.4.tgz#c22190438642da6fb99462cfbbfb6232b4edb9bd"
integrity sha512-b6fycDK7CZWpVXbTl8qnW2jovXPduWKpZGyVZbjK/V4A9iiTU4gur+JEkjjgGKLiDZOftkRCT/dxGLG6hR9HyA==

realpath-native@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c"
Expand Down

0 comments on commit 47353dd

Please sign in to comment.