bugGNU Octave - Bugs: bug #57158, Shorten output of "path"...

 
 

bug #57158: Shorten output of "path" on terminal by replacing OCTAVE_HOME part

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Sun 03 Nov 2019 12:59:06 PM UTC  
 
Category:  Octave Function Severity:  1 - Wish
Priority:  4 Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Mon 04 Nov 2019 09:37:34 PM UTC, comment #7: 

My original thoughts were just about echo to the screen.

I don't think the output argument of path() should be affected as that's what existing code depends on; not in the least inside core Octave.

Philip Nienhuis <philipnienhuis>
Project Member
Mon 04 Nov 2019 09:15:35 PM UTC, comment #6: 

path() has two calling forms.  If you don't request an output, the data gets printed to screen.  Otherwise, it makes a  single path-separated string.  One possibility would be to change only the 0-output form to show OCTAVE_HOME.

A second possibility would be to document how to translate the output to a full path.  For example,

strrep ("OCTAVE_HOME/path1/path2", "OCTAVE_HOME", OCTAVE_HOME())
or
strcat (OCTAVE_HOME(), "/path1/path2")

Rik <rik5>
Project Administrator
Mon 04 Nov 2019 08:21:31 PM UTC, comment #5: 

_what happens if someone wants to cut and paste an element from the this output?_

You mean, when wanting to do s/th like rmpath ('<<paste>>')

Originally I was thinking to print something like
OCTAVE_HOME = /usr/local
above and/or below the path list, to at least give some clue.

Another, I suppose less preferred way would be to make the print-out configurable.

Philip Nienhuis <philipnienhuis>
Project Member
Mon 04 Nov 2019 07:36:35 PM UTC, comment #4: 

I prefer looking at the shorter lines, but what happens if someone wants to cut and paste an element from the this output?

John W. Eaton <jwe>
Project Administrator
Mon 04 Nov 2019 06:52:32 PM UTC, comment #3: 

I'm not that bothered if we were to just write "OCTAVE_HOME" with no surrounding characters either.

Rik <rik5>
Project Administrator
Mon 04 Nov 2019 06:10:25 PM UTC, comment #2: 

Are we sufficiently Unicode-ready that the replacement string could be "«OCTAVE_HOME»" instead?

Mike Miller <mtmiller>
Project Administrator
Sun 03 Nov 2019 04:19:39 PM UTC, comment #1: 

I think this would be a great idea.  It's a little tougher to implement because path is a C++ function, but this would be the gist of code that would do it assuming the PATH was available in a cell string array.

HOME = OCTAVE_HOME ();
new_path = strrep (PATH, HOME, "<OCTAVE_HOME>");

Rik <rik5>
Project Administrator
Sun 03 Nov 2019 12:59:06 PM UTC, original submission:  

When issuing the "path" command in the terminal some fairly long paths may appear, e.g,:

    :
    :
    L:\philip\devel\octdev\mxe\mxe_64w_20190901\dist\octave\mingw64\share\octave\6.0.0\m\testfun
    L:\philip\devel\octdev\mxe\mxe_64w_20190901\dist\octave\mingw64\share\octave\6.0.0\m\time
    L:\philip\devel\octdev\mxe\mxe_64w_20190901\dist\octave\mingw64\share\octave\6.0.0\m\web
    L:\philip\devel\octdev\mxe\mxe_64w_20190901\dist\octave\mingw64\share\octave\6.0.0\data

    >> OCTAVE_HOME
    ans = L:\philip\devel\octdev\mxe\mxe_64w_20190901\dist\octave\mingw64
    >>

At least on Windows this became more prominent since cset 27609:51d26dd80828 "Use canonical paths in list of load paths (bug #56267)".
I'm wondering if there's any support for shortening those by using e.g., <OCTAVE_HOME> as first entry, so the listing could be

    :
    :
    <OCTAVE_HOME>\share\octave\6.0.0\m\testfun
    <OCTAVE_HOME>\share\octave\6.0.0\m\time
    <OCTAVE_HOME>\share\octave\6.0.0\m\web
    <OCTAVE_HOME>\share\octave\6.0.0\data
    >>

... IMO leading to an easier to grasp and more parsimonious listing.

Philip Nienhuis <philipnienhuis>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by philipnienhuis (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-03 rik5 Priority5 - Normal => 4
    2019-11-03 rik5 StatusNone => Confirmed

    Back to the top


    Powered by Savane 3.5