ARTEMIS-4650 PWD CLI Command
little tool showing current folders on the CLI. Useful to figure out where you're at when using the shell. I get myself typing pwd all the time I am using the CLI, trying to figure out what is my current location and broker being used. this would be useful to make sure you are going to use the right broker when multiple CLI instances are running from multiple terminals.
This commit is contained in:
parent
91556729f1
commit
4c0ed67897
|
@ -36,6 +36,7 @@ import org.apache.activemq.artemis.cli.commands.InputAbstract;
|
|||
import org.apache.activemq.artemis.cli.commands.InvalidOptionsError;
|
||||
import org.apache.activemq.artemis.cli.commands.Kill;
|
||||
import org.apache.activemq.artemis.cli.commands.Mask;
|
||||
import org.apache.activemq.artemis.cli.commands.PWD;
|
||||
import org.apache.activemq.artemis.cli.commands.PrintVersion;
|
||||
import org.apache.activemq.artemis.cli.commands.Run;
|
||||
import org.apache.activemq.artemis.cli.commands.Stop;
|
||||
|
@ -257,6 +258,8 @@ public class Artemis implements Runnable {
|
|||
help.setCommandLine(commandLine);
|
||||
commandLine.addSubcommand(help);
|
||||
|
||||
commandLine.addSubcommand(new PWD());
|
||||
|
||||
commandLine.addSubcommand(new AutoCompletion());
|
||||
|
||||
// we don't include the shell in the shell
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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 org.apache.activemq.artemis.cli.commands;
|
||||
|
||||
import picocli.CommandLine;
|
||||
|
||||
@CommandLine.Command(name = "pwd", description = "Information on current folder and instance.")
|
||||
public class PWD extends ActionAbstract {
|
||||
|
||||
@Override
|
||||
public Object execute(ActionContext context) throws Exception {
|
||||
super.execute(context);
|
||||
|
||||
System.out.println();
|
||||
System.out.println("*******************************************************************************************************************************");
|
||||
System.out.println("* Artemis instance:: " + getBrokerInstance());
|
||||
System.out.println("* Home:: " + getBrokerHome());
|
||||
System.out.println("* etc:: " + getBrokerEtc());
|
||||
|
||||
String canonicalPath = new java.io.File(".").getCanonicalPath();
|
||||
System.out.println("* Current dir:" + canonicalPath);
|
||||
System.out.println("*******************************************************************************************************************************");
|
||||
System.out.println();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue