Skip to content

Commit

Permalink
Removes 'spo folder rename' alias. Closes #5911
Browse files Browse the repository at this point in the history
  • Loading branch information
SmitaNachan authored and waldekmastykarz committed Aug 17, 2024
1 parent fcd505a commit a6962f4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
6 changes: 0 additions & 6 deletions docs/docs/cmd/spo/folder/folder-set.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ Updates a folder
m365 spo folder set [options]
```

## Alias

```sh
m365 spo folder rename [options]
```

## Options

```md definition-list
Expand Down
8 changes: 8 additions & 0 deletions docs/docs/v9-upgrade-guidance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ In the past versions of CLI for Microsoft 365, the command had no output. When u

When using the [spo file copy](./cmd/spo/file/file-copy.mdx) command, please use the new command input. This means that you'll have to remove option `--resetAuthorAndCreated` from your scripts and automation tools.

### Removed 'spo folder rename' alias

The `spo folder rename` command was removed and replaced by the [spo folder set](./cmd/spo/folder/folder-set.mdx) command.

#### What action do I need to take?

Please, update your scripts to use the `spo folder set` command instead of `spo folder rename`.

## SharePoint Framework

### Removed overwrite option from `spfx project github workflow add` command
Expand Down
1 change: 0 additions & 1 deletion src/m365/spo/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default {
FOLDER_LIST: `${prefix} folder list`,
FOLDER_MOVE: `${prefix} folder move`,
FOLDER_REMOVE: `${prefix} folder remove`,
FOLDER_RENAME: `${prefix} folder rename`,
FOLDER_SET: `${prefix} folder set`,
FOLDER_RETENTIONLABEL_ENSURE: `${prefix} folder retentionlabel ensure`,
FOLDER_RETENTIONLABEL_REMOVE: `${prefix} folder retentionlabel remove`,
Expand Down
18 changes: 0 additions & 18 deletions src/m365/spo/commands/folder/folder-set.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { pid } from '../../../../utils/pid.js';
import { session } from '../../../../utils/session.js';
import { sinonUtil } from '../../../../utils/sinonUtil.js';
import commands from '../../commands.js';

import command from './folder-set.js';

describe(commands.FOLDER_SET, () => {
Expand Down Expand Up @@ -72,23 +71,6 @@ describe(commands.FOLDER_SET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct alias', () => {
const alias = command.alias();
assert.deepStrictEqual(alias, [commands.FOLDER_RENAME]);
});

it('correctly logs deprecation warning for yammer command', async () => {
const chalk = (await import('chalk')).default;
const loggerErrSpy = sinon.spy(logger, 'logToStderr');
const commandNameStub = sinon.stub(cli, 'currentCommandName').value(commands.FOLDER_RENAME);
sinon.stub(request, 'patch').resolves();

await command.action(logger, { options: { webUrl: webUrl, url: folderRelServerUrl, name: newFolderName } });
assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${commands.FOLDER_RENAME}' is deprecated. Please use '${commands.FOLDER_SET}' instead.`));

sinonUtil.restore([loggerErrSpy, commandNameStub]);
});

it('renames folder correctly by using server relative URL', async () => {
const patchStub = sinon.stub(request, 'patch').callsFake(async (opts) => {
if (opts.url === `${webUrl}/_api/Web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderRelServerUrl)}')/ListItemAllFields`) {
Expand Down
6 changes: 0 additions & 6 deletions src/m365/spo/commands/folder/folder-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class SpoFolderSetCommand extends SpoCommand {
return 'Updates a folder';
}

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

constructor() {
super();

Expand Down Expand Up @@ -99,8 +95,6 @@ class SpoFolderSetCommand extends SpoCommand {

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
try {
await this.showDeprecationWarning(logger, this.alias()![0], this.name);

if (this.verbose) {
await logger.logToStderr(`Updating folder '${args.options.name}'...`);
}
Expand Down

0 comments on commit a6962f4

Please sign in to comment.