karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [1/2] karaf git commit: Fix less command to work with no arguments and with mvn style urls
Date Tue, 06 Sep 2016 07:12:20 GMT
Repository: karaf
Updated Branches:
  refs/heads/master 7fa2902e2 -> fef371380


Fix less command to work with no arguments and with mvn style urls

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/fef37138
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/fef37138
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/fef37138

Branch: refs/heads/master
Commit: fef371380ed0c4df9f7590835c00540b7101b954
Parents: 5742e9f
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Fri Sep 2 09:57:44 2016 +0200
Committer: Guillaume Nodet <gnodet@apache.org>
Committed: Tue Sep 6 09:11:09 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/karaf/shell/commands/impl/LessAction.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/fef37138/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/LessAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/LessAction.java
b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/LessAction.java
index 9b34b81..6d972f6 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/LessAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/LessAction.java
@@ -19,6 +19,7 @@ package org.apache.karaf.shell.commands.impl;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.karaf.shell.api.action.Action;
@@ -85,15 +86,15 @@ public class LessAction implements Action {
         less.tabs = tabs;
         less.printLineNumbers = printLineNumbers;
         List<Source> sources = new ArrayList<>();
-        if (files.isEmpty()) {
-            files.add("-");
+        if (files == null || files.isEmpty()) {
+            files = Collections.singletonList("-");
         }
         Path pwd = Paths.get(System.getProperty("karaf.home"));
         for (String arg : files) {
             if ("-".equals(arg)) {
                 sources.add(new StdInSource());
             } else {
-                sources.add(new URLSource(pwd.resolve(arg).toUri().toURL(), arg));
+                sources.add(new URLSource(pwd.toUri().resolve(arg).toURL(), arg));
             }
         }
         less.run(sources);


Mime
View raw message