Comments (5)
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.
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
AOn 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.
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 withrex
equivalents in the same way asconvert_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. - 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 thewebbrowser
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.
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.0However 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.
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)
- Culling of Python pkg cache files HOT 3
- Rez not finding a package created while it is running HOT 2
- TSC Meeting 2023-05-18 HOT 1
- Package cache fails to delete on Windows due to .git folder HOT 5
- "rez release --message" incorrect argument parsing
- package_orderers config doesnt apply to ephemerals HOT 1
- rez-release allows overwriting already released version on commit that isn't the release tag HOT 4
- Allow releasing from a checked out tag of existing release HOT 2
- Unable to use package cache from within a rez-env HOT 2
- Python 2.7 tests in CI failing
- Allow to configure execution policy for Powershell/pwsh plugins
- 'gbk' codec can't encode character '\u200b' when resolve context
- TSC Meeting 2023-07-20
- TSC Meeting 2023-08-17 HOT 4
- Add -f json output support to rez-status CLI tool
- Take ownership of https://rez.readthedocs.io HOT 2
- TSC chair transition after Allan stepped down HOT 6
- rez-pip installation of pywin32 import error HOT 5
- 404 links on pages in wiki HOT 2
- Test command doesn't run when defined as list
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rez.