This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/js/directives/ui/image-command/image-command.component.ts

27 lines
766 B
TypeScript
Raw Normal View History

2019-11-12 16:09:47 +00:00
import { Input, Component, Inject } from 'ng-metadata/core';
/**
* A component which displays an image's command, nicely formatted.
*/
@Component({
selector: 'image-command',
templateUrl: '/static/js/directives/ui/image-command/image-command.component.html',
})
export class ImageCommandComponent {
@Input('<') public command: string;
private getDockerfileCommand(command: string[]): string {
if (!command || !command.length) { return ''; }
command = command.join(' ').split(' ');
// ["/bin/sh", "-c", "#(nop)", "RUN", "foo"]
if (command[0] != '/bin/sh' || command[1] != '-c') { return ''; }
if (command[2].trim() != '#(nop)') {
return 'RUN ' + command.slice(2).join(' ');
}
return command.slice(3).join(' ');
};
}