Giter VIP home page Giter VIP logo

Comments (5)

nerdvegas avatar nerdvegas commented on May 14, 2024

Eh? I started doing this, but then realised that python has a 'webbrowser'
builtin module that does all the hard work for you. When you use
'BROWSER', that triggers use of this module instead... It's not
expanding an env-var. I haven't documented this anywhere yet though,
apologies for that. Is it this behaviour that you think is problematic?

Thx
A

On Saturday, November 2, 2013, Chad Dombrova wrote:

the merge_osx branch tries to solve some problems with regard to which
browser is used to open the help url, but i think ultimately the changes
are lipstick on a pig, as they say in the south (or so i'm lead to believe
by television).

i think it is generally a bad idea to attempt to specify the application
that should open the file / url within the package.yaml. using an
environment variable for $BROWSER is at least somewhat portable, but,
even assuming everyone has this variable set, it still only solves the
problem for webpages.

i think a better solution is to use the OS-specific command for opening a
file: e.g. open on osx, and xdg-open on linux (gnome, kde, xfce). this
behavior would occur if the help is in the form of an absolute path or url
only (i.e. no proceeding application name).


Reply to this email directly or view it on GitHubhttps://github.com//issues/39
.

from rez.

nerdvegas avatar nerdvegas commented on May 14, 2024

Related to this, it might be nice to provide man support at some point too.

On Saturday, November 2, 2013, Allan Johns wrote:

Eh? I started doing this, but then realised that python has a 'webbrowser'
builtin module that does all the hard work for you. When you use
'BROWSER', that triggers use of this module instead... It's not
expanding an env-var. I haven't documented this anywhere yet though,
apologies for that. Is it this behaviour that you think is problematic?

Thx
A

On Saturday, November 2, 2013, Chad Dombrova wrote:

the merge_osx branch tries to solve some problems with regard to which
browser is used to open the help url, but i think ultimately the changes
are lipstick on a pig, as they say in the south (or so i'm lead to believe
by television).

i think it is generally a bad idea to attempt to specify the application
that should open the file / url within the package.yaml. using an
environment variable for $BROWSER is at least somewhat portable, but,
even assuming everyone has this variable set, it still only solves the
problem for webpages.

i think a better solution is to use the OS-specific command for opening a
file: e.g. open on osx, and xdg-open on linux (gnome, kde, xfce). this
behavior would occur if the help is in the form of an absolute path or url
only (i.e. no proceeding application name).


Reply to this email directly or view it on GitHubhttps://github.com//issues/39
.

from rez.

mstreatfield avatar mstreatfield commented on May 14, 2024

Hello,

I'm looking to implement the rez help command based on the Rez 2.0 changes - I can't see it's be done anywhere so thought I'd take a stab as it's a really useful feature. My initial plan is to mimic the functionality provided by rez help in Rez 1.0

However as part of that I remember this ticket.

Currently our help entries are nearly all of the form:

help:
- ["Documentation", "$BROWSER !ROOT!/doc/index.html"]

However from looking at the resources schema, I think the following is also supported:

help: !ROOT!/doc/index.html
  1. What is the best approach to handling the expansion of old-style command such as !ROOT!. My initial thought is to swap them out with rex equivalents in the same way as convert_old_commands (so in this example we'd get {root}) and then somehow run them through the rex interpreter to give me the proper values.
  2. How to handle the $BROWSER value and the other comments in this ticket. I'm wondering if I explicitly strip out this token before passing to the underlying xdg-open (or whatever is configured for that OS). This has the advantage over using the webbrowser module explicitly as I can more easily open other document types - but would this handle man pages, for example?

What do you think?

Mark.

from rez.

nerdvegas avatar nerdvegas commented on May 14, 2024

On Mon, Jul 7, 2014 at 1:07 AM, Mark Streatfield [email protected]
wrote:

Hello,

I'm looking to implement the rez help command based on the Rez 2.0
changes - I can't see it's be done anywhere so thought I'd take a stab as
it's a really useful feature. My initial plan is to mimic the functionality
provided by rez help in Rez 1.0

However as part of that I remember this ticket.

Currently our help entries are nearly all of the form:

help:

  • ["Documentation", "$BROWSER !ROOT!/doc/index.html"]

However from looking at the resources schema, I think the following is
also supported:

help: !ROOT!/doc/index.html

What is the best approach to handling the expansion of old-style
command such as !ROOT!. My initial thought is to swap them out with rex
equivalents in the same way as convert_old_commands (so in this
example we'd get {root}) and then somehow run them through the rex
interpreter to give me the proper values.

Yup, do that. In utils.py there's an ObjectStringFormatter class that
makes this easy... just create a dict containing 'root' and 'base' (all you
need access to in rez-help imo), then instantiate ObjectStringFormatter
with this dict and format the help string.

How to handle the $BROWSER value and the other comments in this
ticket. I'm wondering if I explicitly strip out this token before passing
to the underlying xdg-open (or whatever is configured for that OS).
This has the advantage over using the webbrowser module explicitly as
I can more easily open other document types - but would this handle man
pages, for example?

This was already dealt with in the code that's now in
to_delete/cli/help.py I think. BROWSER, if present, is replaced with
whatever config.browser evaluates to. If None (the default), it uses
python's builtin webbrowser module to launch the browser, this is better
than using xdg-open for example, because it's cross platform.

help.py also supports a new format, where you can just provide a url and
nothing else, in that case it assumes this is a url and again uses
webbrowser to launch it.

In summary I think to_delete/cli/help.py does things correctly, it just
needs to be ported wrt resources.

What do you think?

Mark.


Reply to this email directly or view it on GitHub
#39 (comment).

from rez.

nerdvegas avatar nerdvegas commented on May 14, 2024

Yup, do that. In utils.py there's an ObjectStringFormatter class that
makes this easy... just create a dict containing 'root' and 'base' (all you
need access to in rez-help imo), then instantiate ObjectStringFormatter
with this dict and format the help string.

*of course you need to swap !ROOT! to {root} before you do this, just to be
clear.

from rez.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.