mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Move commandInterface to the separate module: towards v2 refactoring
GitOrigin-RevId: 18dcc57922878c8ad1fe0bb6be85097d4d81cc34
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0972d35d6e
commit
e95af7e141
Generated
+2
-1
@@ -629,6 +629,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/color-schemes/twilight-color-scheme/intellij.color.scheme.twilight.iml" filepath="$PROJECT_DIR$/plugins/color-schemes/twilight-color-scheme/intellij.color.scheme.twilight.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/color-schemes/vibrant-ink-color-scheme/intellij.color.scheme.vibrant_ink.iml" filepath="$PROJECT_DIR$/plugins/color-schemes/vibrant-ink-color-scheme/intellij.color.scheme.vibrant_ink.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/color-schemes/warm-neon-color-scheme/intellij.color.scheme.warmNeon.iml" filepath="$PROJECT_DIR$/plugins/color-schemes/warm-neon-color-scheme/intellij.color.scheme.warmNeon.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/commandInterface/intellij.commandInterface.iml" filepath="$PROJECT_DIR$/commandInterface/intellij.commandInterface.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/commander/intellij.commander.iml" filepath="$PROJECT_DIR$/plugins/commander/intellij.commander.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/completion-ml-ranking/intellij.completionMlRanking.iml" filepath="$PROJECT_DIR$/plugins/completion-ml-ranking/intellij.completionMlRanking.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/completion-ml-ranking/intellij.completionMlRanking.tests.iml" filepath="$PROJECT_DIR$/plugins/completion-ml-ranking/intellij.completionMlRanking.tests.iml" />
|
||||
@@ -1480,4 +1481,4 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/util/test-generator-fir/kotlin.util.test-generator-fir.iml" filepath="$PROJECT_DIR$/plugins/kotlin/util/test-generator-fir/kotlin.util.test-generator-fir.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
||||
Generated
+2
-1
@@ -51,6 +51,7 @@
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/android" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
||||
@@ -0,0 +1 @@
|
||||
Language for command-line commands and arguments POSIX with GNU extensions
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.impl.*;
|
||||
import com.intellij.commandInterface.commandLine.psi.impl.*;
|
||||
|
||||
public interface CommandLineElementTypes {
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.lang.PsiBuilder.Marker;
|
||||
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import static com.jetbrains.commandInterface.commandLine.CommandLineParserUtil.*;
|
||||
import static com.intellij.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import static com.intellij.commandInterface.commandLine.CommandLineParserUtil.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.lexer.FlexLexer;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
import static com.intellij.psi.TokenType.BAD_CHARACTER;
|
||||
import static com.intellij.psi.TokenType.WHITE_SPACE;
|
||||
import static com.intellij.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
|
||||
%%
|
||||
|
||||
%{
|
||||
public _CommandLineLexer() {
|
||||
this((java.io.Reader)null);
|
||||
}
|
||||
%}
|
||||
|
||||
%public
|
||||
%class _CommandLineLexer
|
||||
%implements FlexLexer
|
||||
%function advance
|
||||
%type IElementType
|
||||
%unicode
|
||||
|
||||
EOL=\R
|
||||
WHITE_SPACE=\s+
|
||||
|
||||
SPACE=[ \t\n\x0B\f\r]+
|
||||
LITERAL_STARTS_FROM_LETTER=[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!|\*)*
|
||||
LITERAL_STARTS_FROM_DIGIT=[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!|\*)*
|
||||
LITERAL_STARTS_FROM_SYMBOL=([/\~\.!*]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!|\*)*)
|
||||
SPACED_LITERAL_STARTS_FROM_LETTER=\"[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*\"
|
||||
SPACED_LITERAL_STARTS_FROM_DIGIT=\"[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*\"
|
||||
SPACED_LITERAL_STARTS_FROM_SYMBOL=\"([/\~\.!*]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*)\"
|
||||
SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER='[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*'
|
||||
SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT='[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*'
|
||||
SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL='([/\~\.!*]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*)'
|
||||
SHORT_OPTION_NAME_TOKEN=-[:letter:]
|
||||
LONG_OPTION_NAME_TOKEN=--[:letter:](-|[a-zA-Z_0-9])*
|
||||
|
||||
%%
|
||||
<YYINITIAL> {
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
|
||||
"=" { return EQ; }
|
||||
|
||||
{SPACE} { return SPACE; }
|
||||
{LITERAL_STARTS_FROM_LETTER} { return LITERAL_STARTS_FROM_LETTER; }
|
||||
{LITERAL_STARTS_FROM_DIGIT} { return LITERAL_STARTS_FROM_DIGIT; }
|
||||
{LITERAL_STARTS_FROM_SYMBOL} { return LITERAL_STARTS_FROM_SYMBOL; }
|
||||
{SPACED_LITERAL_STARTS_FROM_LETTER} { return SPACED_LITERAL_STARTS_FROM_LETTER; }
|
||||
{SPACED_LITERAL_STARTS_FROM_DIGIT} { return SPACED_LITERAL_STARTS_FROM_DIGIT; }
|
||||
{SPACED_LITERAL_STARTS_FROM_SYMBOL} { return SPACED_LITERAL_STARTS_FROM_SYMBOL; }
|
||||
{SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER} { return SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER; }
|
||||
{SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT} { return SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT; }
|
||||
{SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL} { return SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL; }
|
||||
{SHORT_OPTION_NAME_TOKEN} { return SHORT_OPTION_NAME_TOKEN; }
|
||||
{LONG_OPTION_NAME_TOKEN} { return LONG_OPTION_NAME_TOKEN; }
|
||||
|
||||
}
|
||||
|
||||
[^] { return BAD_CHARACTER; }
|
||||
+2
-4
@@ -1,16 +1,14 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
// Generated by JFlex 1.9.1 http://jflex.de/ (tweaked for IntelliJ platform)
|
||||
// source: _CommandLineLexer.flex
|
||||
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.lexer.FlexLexer;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
import static com.intellij.psi.TokenType.BAD_CHARACTER;
|
||||
import static com.intellij.psi.TokenType.WHITE_SPACE;
|
||||
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import static com.intellij.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
|
||||
|
||||
public class _CommandLineLexer implements FlexLexer {
|
||||
+9
-13
@@ -1,13 +1,13 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine.psi;
|
||||
package com.intellij.commandInterface.commandLine.psi;
|
||||
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLinePart;
|
||||
import com.jetbrains.commandInterface.command.Argument;
|
||||
import com.jetbrains.commandInterface.command.Help;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import com.intellij.commandInterface.commandLine.CommandLinePart;
|
||||
import com.intellij.commandInterface.command.Argument;
|
||||
import com.intellij.commandInterface.command.Help;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
|
||||
public interface CommandLineArgument extends CommandLinePart {
|
||||
|
||||
@@ -38,16 +38,12 @@ public interface CommandLineArgument extends CommandLinePart {
|
||||
@Nullable
|
||||
PsiElement getSpacedLiteralStartsFromSymbol();
|
||||
|
||||
@Nullable
|
||||
Option findOptionForOptionArgument();
|
||||
@Nullable Option findOptionForOptionArgument();
|
||||
|
||||
@Nullable
|
||||
Argument findRealArgument();
|
||||
@Nullable Argument findRealArgument();
|
||||
|
||||
@Nullable
|
||||
Help findBestHelp();
|
||||
@Nullable Help findBestHelp();
|
||||
|
||||
@NotNull
|
||||
String getValueNoQuotes();
|
||||
@NotNull String getValueNoQuotes();
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine.psi;
|
||||
package com.intellij.commandInterface.commandLine.psi;
|
||||
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLinePart;
|
||||
import com.intellij.commandInterface.commandLine.CommandLinePart;
|
||||
|
||||
public interface CommandLineCommand extends CommandLinePart {
|
||||
|
||||
+6
-10
@@ -1,11 +1,11 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine.psi;
|
||||
package com.intellij.commandInterface.commandLine.psi;
|
||||
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLinePart;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import com.intellij.commandInterface.commandLine.CommandLinePart;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
|
||||
public interface CommandLineOption extends CommandLinePart {
|
||||
|
||||
@@ -15,16 +15,12 @@ public interface CommandLineOption extends CommandLinePart {
|
||||
@Nullable
|
||||
PsiElement getShortOptionNameToken();
|
||||
|
||||
@Nullable
|
||||
@NonNls
|
||||
String getOptionName();
|
||||
@Nullable @NonNls String getOptionName();
|
||||
|
||||
boolean isLong();
|
||||
|
||||
@Nullable
|
||||
Option findRealOption();
|
||||
@Nullable Option findRealOption();
|
||||
|
||||
@Nullable
|
||||
CommandLineArgument findArgument();
|
||||
@Nullable CommandLineArgument findArgument();
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine.psi;
|
||||
package com.intellij.commandInterface.commandLine.psi;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLinePart;
|
||||
import com.intellij.commandInterface.commandLine.CommandLinePart;
|
||||
|
||||
public class CommandLineVisitor extends PsiElementVisitor {
|
||||
|
||||
+16
-16
@@ -1,5 +1,5 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine.psi.impl;
|
||||
package com.intellij.commandInterface.commandLine.psi.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.*;
|
||||
@@ -7,16 +7,16 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLineElement;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.*;
|
||||
import com.jetbrains.commandInterface.command.Argument;
|
||||
import com.jetbrains.commandInterface.command.Help;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import static com.intellij.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineElement;
|
||||
import com.intellij.commandInterface.commandLine.psi.*;
|
||||
import com.intellij.commandInterface.command.Argument;
|
||||
import com.intellij.commandInterface.command.Help;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
|
||||
public class CommandLineArgumentImpl extends CommandLineElement implements CommandLineArgument {
|
||||
|
||||
public CommandLineArgumentImpl(ASTNode node) {
|
||||
public CommandLineArgumentImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -84,23 +84,23 @@ public class CommandLineArgumentImpl extends CommandLineElement implements Comma
|
||||
return findChildByType(SPACED_LITERAL_STARTS_FROM_SYMBOL);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Option findOptionForOptionArgument() {
|
||||
@Override
|
||||
public @Nullable Option findOptionForOptionArgument() {
|
||||
return CommandLinePsiImplUtils.findOptionForOptionArgument(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Argument findRealArgument() {
|
||||
@Override
|
||||
public @Nullable Argument findRealArgument() {
|
||||
return CommandLinePsiImplUtils.findRealArgument(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Help findBestHelp() {
|
||||
@Override
|
||||
public @Nullable Help findBestHelp() {
|
||||
return CommandLinePsiImplUtils.findBestHelp(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getValueNoQuotes() {
|
||||
@Override
|
||||
public @NotNull String getValueNoQuotes() {
|
||||
return CommandLinePsiImplUtils.getValueNoQuotes(this);
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine.psi.impl;
|
||||
package com.intellij.commandInterface.commandLine.psi.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.*;
|
||||
@@ -7,13 +7,13 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLineElement;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.*;
|
||||
import static com.intellij.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineElement;
|
||||
import com.intellij.commandInterface.commandLine.psi.*;
|
||||
|
||||
public class CommandLineCommandImpl extends CommandLineElement implements CommandLineCommand {
|
||||
|
||||
public CommandLineCommandImpl(ASTNode node) {
|
||||
public CommandLineCommandImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
+13
-13
@@ -1,5 +1,5 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package com.jetbrains.commandInterface.commandLine.psi.impl;
|
||||
package com.intellij.commandInterface.commandLine.psi.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.*;
|
||||
@@ -7,14 +7,14 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLineElement;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.*;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import static com.intellij.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineElement;
|
||||
import com.intellij.commandInterface.commandLine.psi.*;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
|
||||
public class CommandLineOptionImpl extends CommandLineElement implements CommandLineOption {
|
||||
|
||||
public CommandLineOptionImpl(ASTNode node) {
|
||||
public CommandLineOptionImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -40,23 +40,23 @@ public class CommandLineOptionImpl extends CommandLineElement implements Command
|
||||
return findChildByType(SHORT_OPTION_NAME_TOKEN);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNls
|
||||
public String getOptionName() {
|
||||
@Override
|
||||
public @Nullable @NonNls String getOptionName() {
|
||||
return CommandLinePsiImplUtils.getOptionName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLong() {
|
||||
return CommandLinePsiImplUtils.isLong(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Option findRealOption() {
|
||||
@Override
|
||||
public @Nullable Option findRealOption() {
|
||||
return CommandLinePsiImplUtils.findRealOption(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CommandLineArgument findArgument() {
|
||||
@Override
|
||||
public @Nullable CommandLineArgument findArgument() {
|
||||
return CommandLinePsiImplUtils.findArgument(this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.execution" />
|
||||
<orderEntry type="module" module-name="intellij.platform.editor" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,26 @@
|
||||
<idea-plugin>
|
||||
|
||||
<!--
|
||||
Extension points to support gnu command line language.
|
||||
See {@link com.intellij.commandInterface.commandLine}
|
||||
-->
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
|
||||
|
||||
<lang.parserDefinition language="CommandLine"
|
||||
implementationClass="com.intellij.commandInterface.commandLine.CommandLineParserDefinition"/>
|
||||
<lang.syntaxHighlighter language="CommandLine"
|
||||
implementationClass="com.intellij.commandInterface.commandLine.CommandLineSyntaxHighlighter"/>
|
||||
<psi.referenceContributor language="CommandLine"
|
||||
implementation="com.intellij.commandInterface.commandLine.CommandLineReferenceContributor"/>
|
||||
<lang.elementManipulator forClass="com.intellij.commandInterface.commandLine.CommandLineElement"
|
||||
implementationClass="com.intellij.commandInterface.commandLine.CommandLineElementManipulator"/>
|
||||
<localInspection language="CommandLine" shortName="CommandLineInspection" bundle="com.intellij.commandInterface.CommandInterfaceBundle" key="commandLine.inspection.name"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
groupKey="INSP.GROUP.python"
|
||||
groupBundle="messages.PyBundle"
|
||||
implementationClass="com.intellij.commandInterface.commandLine.CommandLineInspection"/>
|
||||
<lang.documentationProvider language="CommandLine"
|
||||
implementationClass="com.intellij.commandInterface.commandLine.CommandLineDocumentationProvider"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.commandInterface
|
||||
|
||||
import com.intellij.DynamicBundle
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
import java.util.function.Supplier
|
||||
|
||||
private const val BUNDLE: @NonNls String = "com.intellij.commandInterface.CommandInterfaceBundle"
|
||||
|
||||
internal object CommandInterfaceBundle : DynamicBundle(BUNDLE) {
|
||||
|
||||
@JvmStatic
|
||||
fun message(key: @PropertyKey(resourceBundle = BUNDLE) String, vararg params: Any): @Nls String {
|
||||
return getMessage(key, *params)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun messagePointer(key: @PropertyKey(resourceBundle = BUNDLE) String, vararg params: Any): Supplier<String> {
|
||||
return getLazyMessage(key, *params)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
command.line.parser.error.message=Space between an argument and its value is unexpected
|
||||
commandLine.inspection.name=Incorrect CLI syntax
|
||||
commandLine.inspection.badCommand=Bad or unknown command. Ensure this command exists.
|
||||
commandLine.inspection.badOption=Bad or unknown option. Ensure this option exists.
|
||||
commandLine.inspection.badArgument=Argument cannot have this value. Use autocompletion to check the list of possible values.
|
||||
commandLine.inspection.excessArgument=Excess argument or argument is not possible here
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
/**
|
||||
* Argument type to be used with {@link Argument}
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public enum ArgumentType {
|
||||
/**
|
||||
* String (actually, anything)
|
||||
*/
|
||||
STRING,
|
||||
/**
|
||||
* Integer or long
|
||||
*/
|
||||
INTEGER
|
||||
}
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+3
-18
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -101,7 +86,7 @@ public final class KnownArgumentsInfo implements ArgumentsInfo {
|
||||
public KnownArgumentsInfo(@NotNull final Collection<Argument> arguments,
|
||||
final int minArguments,
|
||||
final int maxArguments) {
|
||||
Preconditions.checkArgument(!arguments.isEmpty(), "At least one argument should be provided");
|
||||
assert !arguments.isEmpty(): "At least one argument should be provided";
|
||||
myArguments.addAll(arguments);
|
||||
myMinArguments = minArguments;
|
||||
myMaxArguments = maxArguments;
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* TODO: Redundant?!
|
||||
* Case when command has no arguments (for sure!)
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public final class NoArgumentsInfo implements ArgumentsInfo {
|
||||
/**
|
||||
* Instance to use when command has no arguments
|
||||
*/
|
||||
public static final ArgumentsInfo INSTANCE = new NoArgumentsInfo();
|
||||
|
||||
private NoArgumentsInfo() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Pair<Boolean, Argument> getArgument(final int argumentPosition) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+3
-19
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -51,8 +36,7 @@ public final class Option {
|
||||
@NotNull final Help help,
|
||||
@NotNull final Collection<String> shortNames,
|
||||
@NotNull final Collection<String> longNames) {
|
||||
Preconditions
|
||||
.checkArgument(argumentAndQuantity == null || argumentAndQuantity.first > 0, "Illegal args and quantity: " + argumentAndQuantity);
|
||||
assert (argumentAndQuantity == null || argumentAndQuantity.first > 0): "Illegal args and quantity: " + argumentAndQuantity;
|
||||
myArgumentAndQuantity = argumentAndQuantity;
|
||||
myShortNames.addAll(shortNames);
|
||||
myLongNames.addAll(longNames);
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.openapi.module.Module;
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
/**
|
||||
* <h1>Command with arguments and options.</h1>
|
||||
* <p>
|
||||
* Each {@link com.intellij.commandInterface.command.Command} may have one or more positional {@link com.intellij.commandInterface.command.Argument arguments}
|
||||
* and several {@link com.intellij.commandInterface.command.Option options} (with arguments as well).
|
||||
* You need to implemenet {@link com.intellij.commandInterface.command.Command} first.
|
||||
* </p>
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.intellij.commandInterface.command;
|
||||
+6
-20
@@ -1,26 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.command.Argument;
|
||||
import com.jetbrains.commandInterface.command.Help;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.intellij.commandInterface.command.Argument;
|
||||
import com.intellij.commandInterface.command.Help;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+6
-20
@@ -1,26 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.command.Help;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineCommand;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.command.Help;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineCommand;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+11
-11
@@ -1,20 +1,20 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.command.Help;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
import com.intellij.lang.documentation.DocumentationProvider;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.command.Help;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineCommand;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineVisitor;
|
||||
import com.jetbrains.python.psi.PyUtil;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineCommand;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineVisitor;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -89,7 +89,7 @@ public final class CommandLineDocumentationProvider implements DocumentationProv
|
||||
return null;
|
||||
}
|
||||
|
||||
final CommandLineElement commandLineElement = PyUtil.as(element, CommandLineElement.class);
|
||||
final CommandLineElement commandLineElement = ObjectUtils.tryCast(element, CommandLineElement.class);
|
||||
if (commandLineElement == null) {
|
||||
return null;
|
||||
}
|
||||
+4
-18
@@ -1,27 +1,13 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.AbstractElementManipulator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Manipulator to support reference injection. Will fail with out of it.
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public final class CommandLineElementManipulator extends AbstractElementManipulator<CommandLineElement> {
|
||||
|
||||
@Override
|
||||
public CommandLineElement handleContentChange(@NotNull final CommandLineElement element,
|
||||
@NotNull final TextRange range,
|
||||
final String newContent) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+4
-18
@@ -1,25 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReferenceBase;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Command line element type to be used in parser
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
final class CommandLineElementType extends IElementType {
|
||||
CommandLineElementType(@NotNull @NonNls final String debugName) {
|
||||
super(debugName, CommandLineLanguage.INSTANCE);
|
||||
}
|
||||
}
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+9
-23
@@ -1,29 +1,15 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.LocalInspectionToolSession;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.commandInterface.CommandInterfaceBundle;
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.commandLine.psi.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.*;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -83,7 +69,7 @@ public final class CommandLineInspection extends LocalInspectionTool {
|
||||
return;
|
||||
}
|
||||
}
|
||||
myHolder.registerProblem(o, PyBundle.message("commandLine.inspection.badCommand"));
|
||||
myHolder.registerProblem(o, CommandInterfaceBundle.message("commandLine.inspection.badCommand"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,7 +77,7 @@ public final class CommandLineInspection extends LocalInspectionTool {
|
||||
super.visitOption(o);
|
||||
final ValidationResult validationResult = getValidationResult(o);
|
||||
if (validationResult != null && validationResult.isBadValue(o)) {
|
||||
myHolder.registerProblem(o, PyBundle.message("commandLine.inspection.badOption"));
|
||||
myHolder.registerProblem(o, CommandInterfaceBundle.message("commandLine.inspection.badOption"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,10 +88,10 @@ public final class CommandLineInspection extends LocalInspectionTool {
|
||||
final ValidationResult validationResult = getValidationResult(o);
|
||||
if (validationResult != null) {
|
||||
if (validationResult.isBadValue(o)) {
|
||||
myHolder.registerProblem(o, PyBundle.message("commandLine.inspection.badArgument"));
|
||||
myHolder.registerProblem(o, CommandInterfaceBundle.message("commandLine.inspection.badArgument"));
|
||||
}
|
||||
else if (validationResult.isExcessArgument(o)) {
|
||||
myHolder.registerProblem(o, PyBundle.message("commandLine.inspection.excessArgument"));
|
||||
myHolder.registerProblem(o, CommandInterfaceBundle.message("commandLine.inspection.excessArgument"));
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Command line language itself
|
||||
* <pre>my_command --option=value foo</pre>
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public final class CommandLineLanguage extends Language {
|
||||
public static final CommandLineLanguage INSTANCE = new CommandLineLanguage();
|
||||
|
||||
private CommandLineLanguage() {
|
||||
super("CommandLine");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LanguageFileType getAssociatedFileType() {
|
||||
return CommandLineFileType.INSTANCE;
|
||||
}
|
||||
}
|
||||
+4
-18
@@ -1,24 +1,10 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+6
-4
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.ParserDefinition;
|
||||
@@ -13,8 +13,10 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IFileElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.Factory;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineElementTypes.Factory;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineParser;
|
||||
import com.intellij.commandInterface.commandLine._CommandLineLexer;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
+4
-18
@@ -1,25 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.commandInterface.CommandInterfaceBundle;
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.lang.parser.GeneratedParserUtilBase;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -46,7 +32,7 @@ final class CommandLineParserUtil extends GeneratedParserUtilBase {
|
||||
if (tokenType == CommandLineElementTypes.EQ) {
|
||||
if (leftElement.equals(CommandLineElementTypes.LONG_OPTION_NAME_TOKEN)) {
|
||||
if (rightElement == null || TokenType.WHITE_SPACE.equals(rightElement)) {
|
||||
b.error(PyBundle.message("command.line.parser.error.message"));
|
||||
b.error(CommandInterfaceBundle.message("command.line.parser.error.message"));
|
||||
}
|
||||
b.advanceLexer();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Any part of commandline from file till any element
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public interface CommandLinePart extends PsiElement {
|
||||
/**
|
||||
* @return command associated with this command line (if any)
|
||||
*/
|
||||
@Nullable
|
||||
Command findRealCommand();
|
||||
|
||||
/**
|
||||
* @return command line file where this part sits
|
||||
*/
|
||||
@SuppressWarnings("ClassReferencesSubclass") // Although referencing child is bad idea, this hierarchy is coupled tightly and considered to be solid part
|
||||
@Nullable
|
||||
CommandLineFile getCommandLineFile();
|
||||
}
|
||||
+3
-17
@@ -1,24 +1,10 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.patterns.PlatformPatterns;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.*;
|
||||
import com.intellij.commandInterface.commandLine.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.lexer.FlexAdapter;
|
||||
import com.intellij.lexer.Lexer;
|
||||
@@ -7,6 +7,8 @@ import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineElementTypes;
|
||||
import com.intellij.commandInterface.commandLine._CommandLineLexer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.codeInsight.completion.PrioritizedLookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
+6
-20
@@ -1,26 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.command.Argument;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import com.intellij.commandInterface.command.Argument;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+11
-9
@@ -1,3 +1,5 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
/*TODO:Add generation to ant*/
|
||||
|
||||
// This file is used to auto-generate lexer and parser for gnu command line language
|
||||
@@ -6,20 +8,20 @@
|
||||
|
||||
{
|
||||
// All 3 elements should extend this class
|
||||
mixin("option|argument|command")="com.jetbrains.commandInterface.commandLine.CommandLineElement"
|
||||
mixin("option|argument|command")="com.intellij.commandInterface.commandLine.CommandLineElement"
|
||||
// And implement this interface
|
||||
implements("option|argument|command")="com.jetbrains.commandInterface.commandLine.CommandLinePart"
|
||||
implements("option|argument|command")="com.intellij.commandInterface.commandLine.CommandLinePart"
|
||||
|
||||
parserClass = 'com.jetbrains.commandInterface.commandLine.CommandLineParser'
|
||||
parserUtilClass="com.jetbrains.commandInterface.commandLine.CommandLineParserUtil"
|
||||
psiImplUtilClass="com.jetbrains.commandInterface.commandLine.psi.impl.CommandLinePsiImplUtils"
|
||||
psiPackage = 'com.jetbrains.commandInterface.commandLine.psi'
|
||||
psiImplPackage = 'com.jetbrains.commandInterface.commandLine.psi.impl'
|
||||
parserClass = 'com.intellij.commandInterface.commandLine.CommandLineParser'
|
||||
parserUtilClass="com.intellij.commandInterface.commandLine.CommandLineParserUtil"
|
||||
psiImplUtilClass="com.intellij.commandInterface.commandLine.psi.impl.CommandLinePsiImplUtils"
|
||||
psiPackage = 'com.intellij.commandInterface.commandLine.psi'
|
||||
psiImplPackage = 'com.intellij.commandInterface.commandLine.psi.impl'
|
||||
|
||||
elementTypeHolderClass = 'com.jetbrains.commandInterface.commandLine.CommandLineElementTypes'
|
||||
elementTypeHolderClass = 'com.intellij.commandInterface.commandLine.CommandLineElementTypes'
|
||||
psiClassPrefix = "CommandLine"
|
||||
psiVisitorName = "CommandLineVisitor"
|
||||
elementTypeClass = 'com.jetbrains.commandInterface.commandLine.CommandLineElementType'
|
||||
elementTypeClass = 'com.intellij.commandInterface.commandLine.CommandLineElementType'
|
||||
|
||||
|
||||
//TODO: I would suggest making this pattern negative rather than positive in order to support all the characters like ? and others
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
/**
|
||||
* <h1>GNU command line language PSI</h1>
|
||||
* <h2>Command line language</h2>
|
||||
* <p>
|
||||
* <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02">GNU</a> command line language syntax
|
||||
* based on <a href="http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html">POSIX</a> syntax.
|
||||
* <pre>
|
||||
* my_command --option --option-2=argument positional_argument -s
|
||||
* </pre>
|
||||
* </p>
|
||||
* <h2>PSI</h2>
|
||||
* <p>Generation based on Grammar-Kit, see .bnf file, do not edit parser nor lexer manually.
|
||||
* When parsed, {@link com.intellij.commandInterface.commandLine.psi.CommandLineFile} is root element for
|
||||
* {@link com.intellij.commandInterface.commandLine.CommandLineLanguage}.
|
||||
* <strong>Warning</strong>: always fill {@link com.intellij.commandInterface.commandLine.psi.CommandLineFile#setCommandsAndDefaultExecutor(java.util.List, CommandExecutor)}
|
||||
* if possible.
|
||||
* </p>
|
||||
* <h2>Extension points</h2>
|
||||
* <p>This package has a a lot of extension points (language, inspection etc). Make sure all of them are registered</p>
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.commandInterface.command.CommandExecutor;
|
||||
+9
-20
@@ -1,29 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine.psi;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine.psi;
|
||||
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineLanguage;
|
||||
import com.intellij.commandInterface.commandLine.CommandLinePart;
|
||||
import com.intellij.commandInterface.commandLine.ValidationResult;
|
||||
import com.intellij.extapi.psi.PsiFileBase;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.FileViewProvider;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLineLanguage;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLinePart;
|
||||
import com.jetbrains.commandInterface.commandLine.ValidationResult;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineCommand;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+9
-20
@@ -1,27 +1,16 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine.psi;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine.psi;
|
||||
|
||||
import com.intellij.commandInterface.commandLine.ValidationResult;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiWhiteSpace;
|
||||
import com.jetbrains.commandInterface.command.Argument;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import com.jetbrains.commandInterface.commandLine.ValidationResult;
|
||||
import com.intellij.commandInterface.command.Argument;
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+12
-26
@@ -1,30 +1,16 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine.psi.impl;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine.psi.impl;
|
||||
|
||||
import com.intellij.commandInterface.commandLine.CommandLinePart;
|
||||
import com.intellij.commandInterface.commandLine.ValidationResult;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.command.Argument;
|
||||
import com.jetbrains.commandInterface.command.Help;
|
||||
import com.jetbrains.commandInterface.command.Option;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLinePart;
|
||||
import com.jetbrains.commandInterface.commandLine.ValidationResult;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import com.jetbrains.python.psi.PyUtil;
|
||||
import com.intellij.commandInterface.command.Argument;
|
||||
import com.intellij.commandInterface.command.Help;
|
||||
import com.intellij.commandInterface.command.Option;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineOption;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -59,7 +45,7 @@ final class CommandLinePsiImplUtils {
|
||||
@Nullable
|
||||
static CommandLineArgument findArgument(@NotNull final CommandLineOption option) {
|
||||
if (option.getText().endsWith("=")) {
|
||||
return PyUtil.as(option.getNextSibling(), CommandLineArgument.class);
|
||||
return ObjectUtils.tryCast(option.getNextSibling(), CommandLineArgument.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
/**
|
||||
* Gnu command line language PSI implementation.
|
||||
* Do not use this package directly, consider using interfaces from {@link com.intellij.commandInterface.commandLine.psi} instead.
|
||||
* <strong>Warning</strong>: most files in this package is autogenerated. Do not touch them directly.
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.intellij.commandInterface.commandLine.psi.impl;
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
/**
|
||||
* Gnu command line public PSI interfaces: Command, option, argument etc.
|
||||
*
|
||||
* <strong>Warning</strong>: most files in this package is autogenerated. Do not touch them directly.
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.intellij.commandInterface.commandLine.psi;
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
/**
|
||||
* <h1>Command-line interface</h1>
|
||||
* <h2>What is the purpose of this package?</h2>
|
||||
* <p>
|
||||
* This package is based on ideas of command-line with command, positional arguments, options and their arguments.
|
||||
* Initial idea is taken from <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02">POSIX</a>
|
||||
* and enhanced by <a href="http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html">GNU</a>.
|
||||
* It also supported by Python in <a href="https://docs.python.org/2/library/optparse.html">optparse</a> package.
|
||||
* Command-line is something like
|
||||
* <pre>my_command positional_argument -s --long-option --another-long-option=arg1 arg2 some_other_arg</pre>
|
||||
* and this package helps you to parse command lines, highlight errors, display a console-like interface and execute commands.
|
||||
* </p>
|
||||
* <h2>What this package consists of?</h2>
|
||||
* <p>
|
||||
* This package has 2 subpackages:
|
||||
* <ol>
|
||||
* <li>{@link com.intellij.commandInterface.command} contains classes to describe commands, arguments and options.
|
||||
* It is up to you where to obtain list of available commands, but you should implement {@link com.intellij.commandInterface.command.Command}
|
||||
* first, and create list of it with arguments and options. See package info for more details</li>
|
||||
* <li>{@link com.intellij.commandInterface.commandLine} is language based on
|
||||
* <a href="http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html">GNU</a> command line representation.
|
||||
* It has PSI, so it parses command lines into tree of PsiElements. But this package <strong>is not only for parsing</strong>:
|
||||
* If you provide list of
|
||||
* {@link com.intellij.commandInterface.command.Command commands} to {@link com.intellij.commandInterface.commandLine.psi.CommandLineFile}
|
||||
* (see {@link com.intellij.commandInterface.commandLine.psi.CommandLineFile#setCommands(java.util.List)}}}), it will inject references
|
||||
* (to provide autocompletion) and activate inspection to validate options and arguments. </li>
|
||||
*
|
||||
* </ol>
|
||||
* </p>
|
||||
* <h2>How to use this package?</h2>
|
||||
* <ol>
|
||||
* <li>Implement {@link com.intellij.commandInterface.command.Command}</li>
|
||||
* <li>Create list of {@link com.intellij.commandInterface.command.Command commands}</li>
|
||||
* </ol>
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.intellij.commandInterface;
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ object PythonCommunityPluginModules {
|
||||
"intellij.python.grazie",
|
||||
"intellij.python.markdown",
|
||||
"intellij.python.reStructuredText",
|
||||
"intellij.commandInterface",
|
||||
"intellij.python.sdk",
|
||||
"intellij.python.featuresTrainer",
|
||||
"intellij.jupyter.core"
|
||||
|
||||
@@ -145,5 +145,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.ml.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ml" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.coroutines" />
|
||||
<orderEntry type="module" module-name="intellij.commandInterface" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -554,12 +554,6 @@ remote.interpreter.remote.server.permissions=Failed to browse the remote server.
|
||||
remote.interpreter.accessing.remote.interpreter.progress.title=Accessing Remote Interpreter
|
||||
remote.interpreter.feature.is.not.available=Remote interpreter feature is not available
|
||||
|
||||
# CommandLine
|
||||
commandLine.inspection.name=Incorrect CLI syntax
|
||||
commandLine.inspection.badCommand=Bad or unknown command. Ensure this command exists.
|
||||
commandLine.inspection.badOption=Bad or unknown option. Ensure this option exists.
|
||||
commandLine.inspection.badArgument=Argument cannot have this value. Use autocompletion to check the list of possible values.
|
||||
commandLine.inspection.excessArgument=Excess argument or argument is not possible here
|
||||
# What to display of user entered junk
|
||||
commandLine.commandNotFound={0}: command not found
|
||||
|
||||
@@ -1167,7 +1161,6 @@ integrated.tools.configurable.restructuredtext=reStructuredText
|
||||
integrated.tools.configurable.packaging=Packaging
|
||||
integrated.tools.configurable.testing=Testing
|
||||
integrated.tools.configurable.pipenv=Pipenv
|
||||
command.line.parser.error.message=Space between an argument and its value is unexpected
|
||||
|
||||
python.package.installation.notification.message={0} will be installed on the selected interpreter
|
||||
python.package.and.packaging.tools.installation.notification.message=Python packaging tools and {0} will be installed on the selected interpreter
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<idea-plugin>
|
||||
|
||||
<!--
|
||||
Extension points to support gnu command line language.
|
||||
See {@link com.jetbrains.commandInterface.commandLineackage
|
||||
-->
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
|
||||
|
||||
<lang.parserDefinition language="CommandLine"
|
||||
implementationClass="com.jetbrains.commandInterface.commandLine.CommandLineParserDefinition"/>
|
||||
<lang.syntaxHighlighter language="CommandLine"
|
||||
implementationClass="com.jetbrains.commandInterface.commandLine.CommandLineSyntaxHighlighter"/>
|
||||
<psi.referenceContributor language="CommandLine"
|
||||
implementation="com.jetbrains.commandInterface.commandLine.CommandLineReferenceContributor"/>
|
||||
<lang.elementManipulator forClass="com.jetbrains.commandInterface.commandLine.CommandLineElement"
|
||||
implementationClass="com.jetbrains.commandInterface.commandLine.CommandLineElementManipulator"/>
|
||||
<localInspection language="CommandLine" shortName="CommandLineInspection" bundle="messages.PyBundle" key="commandLine.inspection.name"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
groupKey="INSP.GROUP.python"
|
||||
groupBundle="messages.PyBundle"
|
||||
implementationClass="com.jetbrains.commandInterface.commandLine.CommandLineInspection"/>
|
||||
<lang.documentationProvider language="CommandLine"
|
||||
implementationClass="com.jetbrains.commandInterface.commandLine.CommandLineDocumentationProvider"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
+5
-19
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.console;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole;
|
||||
|
||||
import com.intellij.codeInsight.template.impl.TemplateColors;
|
||||
import com.intellij.execution.process.ConsoleHighlighter;
|
||||
@@ -25,9 +11,9 @@ import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.jetbrains.commandInterface.command.Argument;
|
||||
import com.jetbrains.commandInterface.commandLine.ValidationResult;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.commandInterface.command.Argument;
|
||||
import com.intellij.commandInterface.commandLine.ValidationResult;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.commandInterface.console;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole;
|
||||
|
||||
import com.intellij.execution.console.LanguageConsoleBuilder;
|
||||
import com.intellij.execution.console.LanguageConsoleImpl;
|
||||
@@ -20,8 +20,8 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLineLanguage;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineLanguage;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.jetbrains.python.PythonPluginDisposable;
|
||||
import com.jetbrains.python.psi.PyUtil;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
+4
-18
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.console
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole
|
||||
|
||||
import com.intellij.execution.console.LanguageConsoleBuilder
|
||||
import com.intellij.execution.console.LanguageConsoleView
|
||||
@@ -24,8 +10,8 @@ import com.intellij.openapi.wm.ToolWindowManager.Companion.getInstance
|
||||
import com.intellij.ui.content.Content
|
||||
import com.intellij.ui.content.impl.ContentImpl
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import com.jetbrains.commandInterface.command.Command
|
||||
import com.jetbrains.commandInterface.command.CommandExecutor
|
||||
import com.intellij.commandInterface.command.Command
|
||||
import com.intellij.commandInterface.command.CommandExecutor
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.plugins.terminal.TerminalToolWindowFactory
|
||||
|
||||
+6
-20
@@ -1,29 +1,15 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.console;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole;
|
||||
|
||||
import com.intellij.execution.console.LanguageConsoleImpl;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.command.CommandExecutor;
|
||||
import com.jetbrains.commandInterface.commandLine.CommandLineLanguage;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.command.CommandExecutor;
|
||||
import com.intellij.commandInterface.commandLine.CommandLineLanguage;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.psi.PyUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.commandInterface.console;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole;
|
||||
|
||||
import com.intellij.execution.actions.StopProcessAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.commandInterface.console;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole;
|
||||
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.commandInterface.console;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole;
|
||||
|
||||
import com.intellij.execution.runners.AbstractConsoleRunnerWithHistory;
|
||||
import com.intellij.ide.actions.CloseAction;
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.console;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole;
|
||||
|
||||
import com.intellij.execution.console.ProcessBackedConsoleExecuteActionHandler;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
/**
|
||||
* <h1>Command line console</h1>
|
||||
* <p>
|
||||
* Package to display command line console on the Terminal ToolWindow. It supports history, execution, syntax highlighting and so on.
|
||||
* Entry point is {@link com.intellij.python.community.impl.commandInterfaceConsole.CommandLineConsoleApiKt}.
|
||||
* </p>
|
||||
* <p/>
|
||||
* <h2>Technical details</h2>
|
||||
* <p>
|
||||
* This package uses {@link com.intellij.python.community.impl.commandInterfaceConsole.CommandConsole} and it can work in 2 modes: "command-mode"
|
||||
* to accept, highlight and execute commands, and in "process-mode" to pass stdin/stdout to process it execute.
|
||||
* See class documentation for details.
|
||||
* </p>
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
* @see com.intellij.python.community.impl.commandInterfaceConsole.CommandLineConsoleApiKt
|
||||
*/
|
||||
package com.intellij.python.community.impl.commandInterfaceConsole;
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
|
||||
/**
|
||||
* Argument type to be used with {@link Argument}
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public enum ArgumentType {
|
||||
/**
|
||||
* String (actually, anything)
|
||||
*/
|
||||
STRING,
|
||||
/**
|
||||
* Integer or long
|
||||
*/
|
||||
INTEGER
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* TODO: Redundant?!
|
||||
* Case when command has no arguments (for sure!)
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public final class NoArgumentsInfo implements ArgumentsInfo {
|
||||
/**
|
||||
* Instance to use when command has no arguments
|
||||
*/
|
||||
public static final ArgumentsInfo INSTANCE = new NoArgumentsInfo();
|
||||
|
||||
private NoArgumentsInfo() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Pair<Boolean, Argument> getArgument(final int argumentPosition) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* <h1>Command with arguments and options.</h1>
|
||||
* <p>
|
||||
* Each {@link com.jetbrains.commandInterface.command.Command} may have one or more positional {@link com.jetbrains.commandInterface.command.Argument arguments}
|
||||
* and several {@link com.jetbrains.commandInterface.command.Option options} (with arguments as well).
|
||||
* You need to implemenet {@link com.jetbrains.commandInterface.command.Command} first.
|
||||
* </p>
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.jetbrains.commandInterface.command;
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.AbstractElementManipulator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Manipulator to support reference injection. Will fail with out of it.
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public final class CommandLineElementManipulator extends AbstractElementManipulator<CommandLineElement> {
|
||||
|
||||
@Override
|
||||
public CommandLineElement handleContentChange(@NotNull final CommandLineElement element,
|
||||
@NotNull final TextRange range,
|
||||
final String newContent) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Command line element type to be used in parser
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
final class CommandLineElementType extends IElementType {
|
||||
CommandLineElementType(@NotNull @NonNls final String debugName) {
|
||||
super(debugName, CommandLineLanguage.INSTANCE);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Command line language itself
|
||||
* <pre>my_command --option=value foo</pre>
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public final class CommandLineLanguage extends Language {
|
||||
public static final CommandLineLanguage INSTANCE = new CommandLineLanguage();
|
||||
|
||||
private CommandLineLanguage() {
|
||||
super("CommandLine");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LanguageFileType getAssociatedFileType() {
|
||||
return CommandLineFileType.INSTANCE;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Any part of commandline from file till any element
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public interface CommandLinePart extends PsiElement {
|
||||
/**
|
||||
* @return command associated with this command line (if any)
|
||||
*/
|
||||
@Nullable
|
||||
Command findRealCommand();
|
||||
|
||||
/**
|
||||
* @return command line file where this part sits
|
||||
*/
|
||||
@SuppressWarnings("ClassReferencesSubclass") // Although referencing child is bad idea, this hierarchy is coupled tightly and considered to be solid part
|
||||
@Nullable
|
||||
CommandLineFile getCommandLineFile();
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.lexer.FlexLexer;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
import static com.intellij.psi.TokenType.BAD_CHARACTER;
|
||||
import static com.intellij.psi.TokenType.WHITE_SPACE;
|
||||
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
|
||||
|
||||
%%
|
||||
|
||||
%{
|
||||
public _CommandLineLexer() {
|
||||
this((java.io.Reader)null);
|
||||
}
|
||||
%}
|
||||
|
||||
%public
|
||||
%class _CommandLineLexer
|
||||
%implements FlexLexer
|
||||
%function advance
|
||||
%type IElementType
|
||||
%unicode
|
||||
|
||||
EOL=\R
|
||||
WHITE_SPACE=\s+
|
||||
|
||||
SPACE=[ \t\n\x0B\f\r]+
|
||||
LITERAL_STARTS_FROM_LETTER=[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!|\*)*
|
||||
LITERAL_STARTS_FROM_DIGIT=[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!|\*)*
|
||||
LITERAL_STARTS_FROM_SYMBOL=([/\~\.!*]([a-zA-Z_0-9]|:|\\|"/"|\.|-|\!|\*)*)
|
||||
SPACED_LITERAL_STARTS_FROM_LETTER=\"[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*\"
|
||||
SPACED_LITERAL_STARTS_FROM_DIGIT=\"[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*\"
|
||||
SPACED_LITERAL_STARTS_FROM_SYMBOL=\"([/\~\.!*]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*)\"
|
||||
SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER='[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*'
|
||||
SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT='[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*'
|
||||
SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL='([/\~\.!*]([a-zA-Z_0-9]|:|\\|"/"|\.|-|[ \t\n\x0B\f\r]|\!|\*)*)'
|
||||
SHORT_OPTION_NAME_TOKEN=-[:letter:]
|
||||
LONG_OPTION_NAME_TOKEN=--[:letter:](-|[a-zA-Z_0-9])*
|
||||
|
||||
%%
|
||||
<YYINITIAL> {
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
|
||||
"=" { return EQ; }
|
||||
|
||||
{SPACE} { return SPACE; }
|
||||
{LITERAL_STARTS_FROM_LETTER} { return LITERAL_STARTS_FROM_LETTER; }
|
||||
{LITERAL_STARTS_FROM_DIGIT} { return LITERAL_STARTS_FROM_DIGIT; }
|
||||
{LITERAL_STARTS_FROM_SYMBOL} { return LITERAL_STARTS_FROM_SYMBOL; }
|
||||
{SPACED_LITERAL_STARTS_FROM_LETTER} { return SPACED_LITERAL_STARTS_FROM_LETTER; }
|
||||
{SPACED_LITERAL_STARTS_FROM_DIGIT} { return SPACED_LITERAL_STARTS_FROM_DIGIT; }
|
||||
{SPACED_LITERAL_STARTS_FROM_SYMBOL} { return SPACED_LITERAL_STARTS_FROM_SYMBOL; }
|
||||
{SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER} { return SINGLE_Q_SPACED_LITERAL_STARTS_FROM_LETTER; }
|
||||
{SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT} { return SINGLE_Q_SPACED_LITERAL_STARTS_FROM_DIGIT; }
|
||||
{SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL} { return SINGLE_Q_SPACED_LITERAL_STARTS_FROM_SYMBOL; }
|
||||
{SHORT_OPTION_NAME_TOKEN} { return SHORT_OPTION_NAME_TOKEN; }
|
||||
{LONG_OPTION_NAME_TOKEN} { return LONG_OPTION_NAME_TOKEN; }
|
||||
|
||||
}
|
||||
|
||||
[^] { return BAD_CHARACTER; }
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* <h1>GNU command line language PSI</h1>
|
||||
* <h2>Command line language</h2>
|
||||
* <p>
|
||||
* <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02">GNU</a> command line language syntax
|
||||
* based on <a href="http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html">POSIX</a> syntax.
|
||||
* <pre>
|
||||
* my_command --option --option-2=argument positional_argument -s
|
||||
* </pre>
|
||||
* </p>
|
||||
* <h2>PSI</h2>
|
||||
* <p>Generation based on Grammar-Kit, see .bnf file, do not edit parser nor lexer manually.
|
||||
* When parsed, {@link com.jetbrains.commandInterface.commandLine.psi.CommandLineFile} is root element for
|
||||
* {@link com.jetbrains.commandInterface.commandLine.CommandLineLanguage}.
|
||||
* <strong>Warning</strong>: always fill {@link com.jetbrains.commandInterface.commandLine.psi.CommandLineFile#setCommandsAndDefaultExecutor(java.util.List, com.jetbrains.commandInterface.command.CommandExecutor)}
|
||||
* if possible.
|
||||
* </p>
|
||||
* <h2>Extension points</h2>
|
||||
* <p>This package has a a lot of extension points (language, inspection etc). Make sure all of them are registered</p>
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gnu command line language PSI implementation.
|
||||
* Do not use this package directly, consider using interfaces from {@link com.jetbrains.commandInterface.commandLine.psi} instead.
|
||||
* <strong>Warning</strong>: most files in this package is autogenerated. Do not touch them directly.
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine.psi.impl;
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gnu command line public PSI interfaces: Command, option, argument etc.
|
||||
*
|
||||
* <strong>Warning</strong>: most files in this package is autogenerated. Do not touch them directly.
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine.psi;
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* <h1>Command line console</h1>
|
||||
* <p>
|
||||
* Package to display command line console on the Terminal ToolWindow. It supports history, execution, syntax highlighting and so on.
|
||||
* Entry point is {@link com.jetbrains.commandInterface.console.CommandLineConsoleApiKt}.
|
||||
* </p>
|
||||
* <p/>
|
||||
* <h2>Technical details</h2>
|
||||
* <p>
|
||||
* This package uses {@link com.jetbrains.commandInterface.console.CommandConsole} and it can work in 2 modes: "command-mode"
|
||||
* to accept, highlight and execute commands, and in "process-mode" to pass stdin/stdout to process it execute.
|
||||
* See class documentation for details.
|
||||
* </p>
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
* @see com.jetbrains.commandInterface.console.CommandLineConsoleApiKt
|
||||
*/
|
||||
package com.jetbrains.commandInterface.console;
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* <h1>Command-line interface</h1>
|
||||
* <h2>What is the purpose of this package?</h2>
|
||||
* <p>
|
||||
* This package is based on ideas of command-line with command, positional arguments, options and their arguments.
|
||||
* Initial idea is taken from <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02">POSIX</a>
|
||||
* and enhanced by <a href="http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html">GNU</a>.
|
||||
* It also supported by Python in <a href="https://docs.python.org/2/library/optparse.html">optparse</a> package.
|
||||
* Command-line is something like
|
||||
* <pre>my_command positional_argument -s --long-option --another-long-option=arg1 arg2 some_other_arg</pre>
|
||||
* and this package helps you to parse command lines, highlight errors, display a console-like interface and execute commands.
|
||||
* </p>
|
||||
* <h2>What this package consists of?</h2>
|
||||
* <p>
|
||||
* This package has 3 subpackages:
|
||||
* <ol>
|
||||
* <li>{@link com.jetbrains.commandInterface.command} contains classes to describe commands, arguments and options.
|
||||
* It is up to you where to obtain list of available commands, but you should implement {@link com.jetbrains.commandInterface.command.Command}
|
||||
* first, and create list of it with arguments and options. See package info for more details</li>
|
||||
* <li>{@link com.jetbrains.commandInterface.commandLine} is language based on
|
||||
* <a href="http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html">GNU</a> command line representation.
|
||||
* It has PSI, so it parses command lines into tree of PsiElements. But this package <strong>is not only for parsing</strong>:
|
||||
* If you provide list of
|
||||
* {@link com.jetbrains.commandInterface.command.Command commands} to {@link com.jetbrains.commandInterface.commandLine.psi.CommandLineFile}
|
||||
* (see {@link com.jetbrains.commandInterface.commandLine.psi.CommandLineFile#setCommandsAndDefaultExecutor(java.util.List, com.jetbrains.commandInterface.command.CommandExecutor)}}), it will inject references
|
||||
* (to provide autocompletion) and activate inspection to validate options and arguments. </li>
|
||||
* <li>{@link com.jetbrains.commandInterface.console} displays console-like interface at the bottom of the screen to give user
|
||||
* ability to wotk with your command-line.</li>
|
||||
* </ol>
|
||||
* </p>
|
||||
* <h2>How to use this package?</h2>
|
||||
* <ol>
|
||||
* <li>Implement {@link com.jetbrains.commandInterface.command.Command}</li>
|
||||
* <li>Create list of {@link com.jetbrains.commandInterface.command.Command commands}</li>
|
||||
* <li>Provide it to {@link com.jetbrains.commandInterface.console.CommandLineConsoleApi#createConsole(com.intellij.openapi.module.Module, java.lang.String, java.util.List)}</li>
|
||||
* </ol>
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.jetbrains.commandInterface;
|
||||
+4
-18
@@ -1,23 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.commandInterface.command.Argument;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.jetbrains.commandInterface.command.Argument;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
+3
-17
@@ -1,22 +1,8 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import org.junit.Assert;
|
||||
|
||||
+4
-18
@@ -1,24 +1,10 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.testFramework.ParsingTestCase;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import org.junit.Assert;
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
+6
-20
@@ -1,26 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.commandInterface.commandLine;
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.commandInterface.commandLine;
|
||||
|
||||
import com.intellij.commandInterface.command.*;
|
||||
import com.intellij.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
|
||||
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
|
||||
import com.jetbrains.commandInterface.command.*;
|
||||
import com.jetbrains.commandInterface.commandLine.psi.CommandLineFile;
|
||||
import com.jetbrains.python.PythonTestUtil;
|
||||
import org.easymock.EasyMock;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -60,8 +46,8 @@ final class CommandTestTools {
|
||||
|
||||
final Pair<List<String>, Boolean> argument = Pair.create(Collections.singletonList("available_argument"), true);
|
||||
options.add(new Option(Pair.create(1, new Argument(new Help("option argument"), argument)), new Help(""),
|
||||
Collections.emptyList(),
|
||||
Collections.singletonList("--available-option")));
|
||||
Collections.emptyList(),
|
||||
Collections.singletonList("--available-option")));
|
||||
|
||||
|
||||
options.add(new Option(null, new Help(""),
|
||||
@@ -19,8 +19,8 @@ import com.intellij.execution.process.ProcessListener;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.jetbrains.commandInterface.command.Command;
|
||||
import com.jetbrains.commandInterface.command.SimpleCommand;
|
||||
import com.intellij.commandInterface.command.Command;
|
||||
import com.intellij.commandInterface.command.SimpleCommand;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
* @see PyProcessWithConsoleTestTask
|
||||
* @see com.jetbrains.commandInterface.command
|
||||
* @see com.intellij.commandInterface.command
|
||||
*/
|
||||
public class CommandBasedProcessRunner extends ProcessWithConsoleRunner {
|
||||
@NotNull
|
||||
|
||||
@@ -51,5 +51,6 @@
|
||||
<orderEntry type="module" module-name="intellij.python.sdk" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="gson" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.tools.ide.metrics.benchmark" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.commandInterface" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user