// Path: shell/src/main/java/org/artificer/shell/util/FileNameCompleterDelegate.java
// public class FileNameCompleterDelegate {
// 
//     /**
//      * Complete.
//      *
//      * @param completerInvocation
//      */
//     public static void complete(CompleterInvocation completerInvocation) {
//         AeshContext context = completerInvocation.getAeshContext();
//         String currentValue = completerInvocation.getGivenCompleteValue();
// 
//         CompleteOperation completeOperation = new CompleteOperation(context, currentValue, 0);
//         if (StringUtils.isBlank(currentValue))
//             new FileLister("", context.getCurrentWorkingDirectory()).
//                     findMatchingDirectories(completeOperation);
//         else
//             new FileLister(currentValue,
//                     context.getCurrentWorkingDirectory()).findMatchingDirectories(completeOperation);
// 
//         if (completeOperation.getCompletionCandidates().size() > 1) {
//             completeOperation.removeEscapedSpacesFromCompletionCandidates();
//         }
// 
//         completerInvocation.setCompleterValuesTerminalString(completeOperation.getCompletionCandidates());
//         if (currentValue != null && completerInvocation.getCompleterValues().size() == 1) {
//             completerInvocation.setAppendSpace(completeOperation.hasAppendSeparator());
//         }
//     }
// 
// }


import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.artificer.atom.archive.ArtificerArchiveException;
import org.artificer.common.ArtifactType;
import org.artificer.shell.i18n.Messages;
import org.artificer.shell.util.ArtifactTypeCompleter;
import org.artificer.shell.util.FileNameCompleterDelegate;
import org.jboss.aesh.cl.Arguments;
import org.jboss.aesh.cl.CommandDefinition;
import org.jboss.aesh.cl.Option;
import org.jboss.aesh.cl.completer.OptionCompleter;
import org.jboss.aesh.console.command.CommandResult;
import org.jboss.aesh.console.command.completer.CompleterInvocation;
import org.jboss.aesh.console.command.invocation.CommandInvocation;
import org.oasis_open.docs.s_ramp.ns.s_ramp_v1.BaseArtifactType;
import java.io.File;
import java.io.InputStream;
import java.util.List;
        }

        String pathToContent = optionalArgument(arguments, 0);

		InputStream contentStream = null;
		try {
			ArtifactType artifactType = ArtifactType.valueOf(type);
			String name = new File(type).getName();
			if (pathToContent != null) {
				File contentFile = new File(pathToContent);
				contentStream = FileUtils.openInputStream(contentFile);
			}
			BaseArtifactType artifact = artifactType.newArtifactInstance();
			artifact.setName(name);
			currentArchive(commandInvocation).addEntry(entryPath, artifact, contentStream);
            commandInvocation.getShell().out().println(Messages.i18n.format("AddEntry.Added", entryPath));
        } catch (ArtificerArchiveException e) {
            commandInvocation.getShell().out().println(Messages.i18n.format("AddEntry.ArtificerArchiveException", e.getLocalizedMessage()));
        } finally {
			IOUtils.closeQuietly(contentStream);
		}

		return CommandResult.SUCCESS;
	}

    private static class Completer implements OptionCompleter<CompleterInvocation> {
        @Override
        public void complete(CompleterInvocation completerInvocation) {
            AddEntryArchiveCommand command = (AddEntryArchiveCommand) completerInvocation.getCommand();
            if (CollectionUtils.isEmpty(command.arguments)) {
// Path: shell/src/main/java/org/artificer/shell/util/FileNameCompleterDelegate.java
// public class FileNameCompleterDelegate {
// 
//     /**
//      * Complete.
//      *
//      * @param completerInvocation
//      */
//     public static void complete(CompleterInvocation completerInvocation) {
//         AeshContext context = completerInvocation.getAeshContext();
//         String currentValue = completerInvocation.getGivenCompleteValue();
// 
//         CompleteOperation completeOperation = new CompleteOperation(context, currentValue, 0);
//         if (StringUtils.isBlank(currentValue))
//             new FileLister("", context.getCurrentWorkingDirectory()).
//                     findMatchingDirectories(completeOperation);
//         else
//             new FileLister(currentValue,
//                     context.getCurrentWorkingDirectory()).findMatchingDirectories(completeOperation);
// 
//         if (completeOperation.getCompletionCandidates().size() > 1) {
//             completeOperation.removeEscapedSpacesFromCompletionCandidates();
//         }
// 
//         completerInvocation.setCompleterValuesTerminalString(completeOperation.getCompletionCandidates());
//         if (currentValue != null && completerInvocation.getCompleterValues().size() == 1) {
//             completerInvocation.setAppendSpace(completeOperation.hasAppendSeparator());
//         }
//     }
// 
// }


// Path: shell/src/main/java/org/artificer/shell/archive/AddEntryArchiveCommand.java
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.artificer.atom.archive.ArtificerArchiveException;
import org.artificer.common.ArtifactType;
import org.artificer.shell.i18n.Messages;
import org.artificer.shell.util.ArtifactTypeCompleter;
import org.artificer.shell.util.FileNameCompleterDelegate;
import org.jboss.aesh.cl.Arguments;
import org.jboss.aesh.cl.CommandDefinition;
import org.jboss.aesh.cl.Option;
import org.jboss.aesh.cl.completer.OptionCompleter;
import org.jboss.aesh.console.command.CommandResult;
import org.jboss.aesh.console.command.completer.CompleterInvocation;
import org.jboss.aesh.console.command.invocation.CommandInvocation;
import org.oasis_open.docs.s_ramp.ns.s_ramp_v1.BaseArtifactType;
import java.io.File;
import java.io.InputStream;
import java.util.List;

        }

        String pathToContent = optionalArgument(arguments, 0);

		InputStream contentStream = null;
		try {
			ArtifactType artifactType = ArtifactType.valueOf(type);
			String name = new File(type).getName();
			if (pathToContent != null) {
				File contentFile = new File(pathToContent);
				contentStream = FileUtils.openInputStream(contentFile);
			}
			BaseArtifactType artifact = artifactType.newArtifactInstance();
			artifact.setName(name);
			currentArchive(commandInvocation).addEntry(entryPath, artifact, contentStream);
            commandInvocation.getShell().out().println(Messages.i18n.format("AddEntry.Added", entryPath));
        } catch (ArtificerArchiveException e) {
            commandInvocation.getShell().out().println(Messages.i18n.format("AddEntry.ArtificerArchiveException", e.getLocalizedMessage()));
        } finally {
			IOUtils.closeQuietly(contentStream);
		}

		return CommandResult.SUCCESS;
	}

    private static class Completer implements OptionCompleter<CompleterInvocation> {
        @Override
        public void complete(CompleterInvocation completerInvocation) {
            AddEntryArchiveCommand command = (AddEntryArchiveCommand) completerInvocation.getCommand();
            if (CollectionUtils.isEmpty(command.arguments)) {
                FileNameCompleterDelegate.complete(completerInvocation);