[134986] trunk/base/src/port/port.tcl

cal at macports.org cal at macports.org
Sun Apr 12 14:31:40 PDT 2015


Revision: 134986
          https://trac.macports.org/changeset/134986
Author:   cal at macports.org
Date:     2015-04-12 14:31:40 -0700 (Sun, 12 Apr 2015)
Log Message:
-----------
base: port.tcl: Don't show portundocumented(7) for non-existant actions, support port help $topic for topics from section 5 and 7

Modified Paths:
--------------
    trunk/base/src/port/port.tcl

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2015-04-12 21:13:14 UTC (rev 134985)
+++ trunk/base/src/port/port.tcl	2015-04-12 21:31:40 UTC (rev 134986)
@@ -1829,7 +1829,7 @@
         # Look for an action with the requested argument
         set actions [find_action $topic]
         if {[llength $actions] == 1} {
-            set page "man1/port-[lindex $actions 0].1$manext"
+            set page "man1/port-[lindex $actions 0].1${manext}"
         } else {
             if {[llength $actions] > 1} {
                 ui_error "\"port help ${action}\" is ambiguous: \n  port help [join $actions "\n  port help "]"
@@ -1838,11 +1838,26 @@
 
             # No valid command specified
             set page ""
+            # Try to find the manpage in sections 5 (configuration) and 7
+            foreach section {5 7} {
+                set page_candidate "man${section}/${topic}.${section}${manext}"
+                set pagepath ${macports::prefix}/share/man/${page_candidate}
+                ui_debug "testing $pagepath..."
+                if {[file exists $pagepath]} {
+                    set page $page_candidate
+                    break
+                }
+            }
         }
     }
 
-    set pagepath ${macports::prefix}/share/man/$page
-    if {$page == "" || ![file exists $pagepath]} {
+    set pagepath ""
+    if {$page ne ""} {
+        set pagepath ${macports::prefix}/share/man/$page
+    }
+    if {$page ne "" && ![file exists $pagepath]} {
+        # command exists, but there doesn't seem to be a manpage for it; open
+        # portundocumented.7
         set page "man7/portundocumented.7$manext"
         set pagepath ${macports::prefix}/share/man/$page
     }
@@ -1860,7 +1875,7 @@
         }
         array set env [array get boot_env]
 
-        if [catch {system -nodup "${macports::autoconf::man_path} $pagepath"} result] {
+        if [catch {system -nodup [list ${macports::autoconf::man_path} $pagepath]} result] {
             ui_debug "$::errorInfo"
             ui_error "Unable to show man page using ${macports::autoconf::man_path}: $result"
             return 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150412/ccd0a820/attachment.html>


More information about the macports-changes mailing list