-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
@W-8044464@ Co-authored-by: Nathan Totten <ntotten@salesforce.com> Co-authored-by: lcampos <lcamposguajardo@gmail.com>
- Loading branch information
Bryan Powell
authored
Nov 11, 2020
1 parent
f253be1
commit 8006edb
Showing
5 changed files
with
345 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/plugin-templates/src/commands/force/staticresource/create.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2020, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
import { flags } from '@salesforce/command'; | ||
import StaticResourceGenerator from '@salesforce/templates/lib/generators/staticResourceGenerator'; | ||
import { AnyJson } from '@salesforce/ts-types'; | ||
import { MessageUtil, TemplateCommand } from '../../../utils'; | ||
|
||
export default class StaticResource extends TemplateCommand { | ||
public static description = MessageUtil.buildDescription( | ||
'StaticResourceDescription', | ||
false | ||
); | ||
public static examples = [ | ||
'$ sfdx force:staticresource:create -n MyResource', | ||
'$ sfdx force:staticresource:create -n MyResource --contenttype application/json', | ||
'$ sfdx force:staticresource:create -n MyResource -d staticresources' | ||
]; | ||
public static help = MessageUtil.buildHelpText( | ||
StaticResource.examples, | ||
false | ||
); | ||
public static longDescription = MessageUtil.get( | ||
'StaticResourceLongDescription' | ||
); | ||
|
||
protected static flagsConfig = { | ||
resourcename: flags.string({ | ||
char: 'n', | ||
description: MessageUtil.get('StaticResourceNameFlagDescription'), | ||
longDescription: MessageUtil.get('StaticResourceNameFlagLongDescription'), | ||
required: true | ||
}), | ||
contenttype: flags.string({ | ||
description: MessageUtil.get('StaticResourceContentTypeFlagDescription'), | ||
longDescription: MessageUtil.get( | ||
'StaticResourceContentTypeFlagLongDescription' | ||
), | ||
default: 'application/zip' | ||
}), | ||
outputdir: flags.string({ | ||
char: 'd', | ||
description: MessageUtil.get('OutputDirFlagDescription'), | ||
longDescription: MessageUtil.get('OutputDirFlagLongDescription'), | ||
default: '.' | ||
}), | ||
apiversion: flags.builtin() | ||
}; | ||
|
||
public async run(): Promise<AnyJson> { | ||
return this.runGenerator(StaticResourceGenerator); | ||
} | ||
} |
Oops, something went wrong.