Skip to content

Commit

Permalink
Removes deprecated aliases. Closes #1338
Browse files Browse the repository at this point in the history
  • Loading branch information
waldekmastykarz committed Jul 24, 2020
1 parent 9d0d05f commit a5b65f3
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 67 deletions.
6 changes: 0 additions & 6 deletions docs/manual/docs/cmd/cli/cli-consent.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ Consent additional permissions for the Azure AD application used by the Office 3
cli consent [options]
```

## Alias

```sh
consent [options]
```

## Options

Option|Description
Expand Down
6 changes: 0 additions & 6 deletions docs/manual/docs/cmd/spo/site/site-remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ Removes the specified site
spo site remove [options]
```

## Alias

```sh
spo site classic remove
```

## Options

Option|Description
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/docs/user-guide/connecting-office-365.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Office 365 CLI uses the _PnP Office 365 Management Shell_ Azure AD application t
To re-consent the _PnP Office 365 Management Shell_ application in your Azure AD, in the command line execute:

```sh
o365 --reconsent
o365 cli reconsent
```

Office 365 CLI will provide you with a URL that you should open in the web browser and sign in with your organizational account. After authenticating, Azure AD will prompt you to approve the new set of permissions. Once you approved the permissions, you will be redirected to an empty page. You can now use all commands in the Office 365 CLI.
Expand Down
23 changes: 0 additions & 23 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import * as fs from 'fs';
import * as path from 'path';
import * as updateNotifier from 'update-notifier';
import config from './config';
import Command from './Command';
import appInsights from './appInsights';
import Utils from './Utils';
import { autocomplete } from './autocomplete';

const packageJSON = require('../package.json');
const vorpal: Vorpal = require('./vorpal-init');
Expand Down Expand Up @@ -102,27 +100,6 @@ appInsights.trackEvent({
updateNotifier({ pkg: packageJSON }).notify({ defer: false });

fs.realpath(__dirname, (err: NodeJS.ErrnoException | null, resolvedPath: string): void => {
if (process.argv.indexOf('--completion:clink:generate') > -1) {
loadAllCommands(resolvedPath);
console.log(autocomplete.getClinkCompletion(vorpal));
process.exit();
}
if (process.argv.indexOf('--completion:sh:generate') > -1) {
loadAllCommands(resolvedPath);
autocomplete.generateShCompletion(vorpal);
process.exit();
}
if (process.argv.indexOf('--completion:sh:setup') > -1) {
loadAllCommands(resolvedPath);
autocomplete.generateShCompletion(vorpal);
autocomplete.setupShCompletion();
process.exit();
}
if (process.argv.indexOf('--reconsent') > -1) {
console.log(`To reconsent the PnP Office 365 Management Shell Azure AD application navigate in your web browser to https://login.microsoftonline.com/${config.tenant}/oauth2/authorize?client_id=${config.cliAadAppId}&response_type=code&prompt=admin_consent`);
process.exit();
}

// disable linux-normalizing args to support JSON and XML values
vorpal.isCommandArgKeyPairNormalized = false;

Expand Down
11 changes: 0 additions & 11 deletions src/o365/cli/commands/cli-consent.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import commands from '../commands';
import globalCommands from '../../commands/commands';
import Command, { CommandOption, CommandValidate } from '../../../Command';
import * as sinon from 'sinon';
import appInsights from '../../../appInsights';
Expand Down Expand Up @@ -57,16 +56,6 @@ describe(commands.CONSENT, () => {
assert.notEqual(command.description, null);
});

it('defines alias', () => {
const alias = command.alias();
assert.notEqual(typeof alias, 'undefined');
});

it('defines correct alias', () => {
const alias = command.alias();
assert.equal((alias && alias.indexOf(globalCommands.CONSENT) > -1), true);
});

it('shows consent URL for yammer permissions for the default multi-tenant app', (done) => {
cmdInstance.action = command.action();
cmdInstance.action({ options: { service: 'yammer' } }, () => {
Expand Down
7 changes: 0 additions & 7 deletions src/o365/cli/commands/cli-consent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import commands from '../commands';
import globalCommands from '../../commands/commands';
import GlobalOptions from '../../../GlobalOptions';
import Command, {
CommandOption,
Expand Down Expand Up @@ -27,19 +26,13 @@ class CliConsentCommand extends Command {
return 'Consent additional permissions for the Azure AD application used by the Office 365 CLI';
}

public alias(): string[] | undefined {
return [globalCommands.CONSENT];
}

public getTelemetryProperties(args: CommandArgs): any {
const telemetryProps: any = super.getTelemetryProperties(args);
telemetryProps.service = args.options.service;
return telemetryProps;
}

public commandAction(cmd: CommandInstance, args: CommandArgs, cb: (err?: any) => void): void {
this.showDeprecationWarning(cmd, globalCommands.CONSENT, commands.CONSENT);

let scope = '';
switch (args.options.service) {
case 'yammer':
Expand Down
1 change: 0 additions & 1 deletion src/o365/commands/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export default {
CONSENT: `consent`,
LOGIN: `login`,
LOGOUT: `logout`,
STATUS: `status`
Expand Down
1 change: 0 additions & 1 deletion src/o365/spo/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export default {
SITE_APPCATALOG_REMOVE: `${prefix} site appcatalog remove`,
SITE_CLASSIC_ADD: `${prefix} site classic add`,
SITE_CLASSIC_LIST: `${prefix} site classic list`,
SITE_CLASSIC_REMOVE: `${prefix} site classic remove`,
SITE_CLASSIC_SET: `${prefix} site classic set`,
SITE_COMMSITE_ENABLE: `${prefix} site commsite enable`,
SITE_GET: `${prefix} site get`,
Expand Down
5 changes: 0 additions & 5 deletions src/o365/spo/commands/site/site-remove.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ describe(commands.SITE_REMOVE, () => {
assert.notEqual(command.description, null);
});

it('defines correct alias', () => {
const alias = command.alias();
assert.equal((alias && alias.indexOf(commands.SITE_CLASSIC_REMOVE) > -1), true);
});

it('aborts removing site when prompt not confirmed', (done) => {
cmdInstance.prompt = (options: any, cb: (result: { continue: boolean }) => void) => {
cb({ continue: false });
Expand Down
6 changes: 0 additions & 6 deletions src/o365/spo/commands/site/site-remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ class SpoSiteRemoveCommand extends SpoCommand {
return 'Removes the specified site';
}

public alias(): string[] | undefined {
return [commands.SITE_CLASSIC_REMOVE];
}

public getTelemetryProperties(args: CommandArgs): any {
const telemetryProps: any = super.getTelemetryProperties(args);
telemetryProps.skipRecycleBin = (!(!args.options.skipRecycleBin)).toString();
Expand All @@ -50,8 +46,6 @@ class SpoSiteRemoveCommand extends SpoCommand {
}

public commandAction(cmd: CommandInstance, args: CommandArgs, cb: () => void): void {
this.showDeprecationWarning(cmd, commands.SITE_CLASSIC_REMOVE, commands.SITE_REMOVE);

const removeSite = (): void => {
this.dots = '';

Expand Down

0 comments on commit a5b65f3

Please sign in to comment.