sunaku / dasht Goto Github PK
View Code? Open in Web Editor NEWπ Search API docs offline, in terminal or browser
Home Page: https://sunaku.github.io/dasht/man
π Search API docs offline, in terminal or browser
Home Page: https://sunaku.github.io/dasht/man
Confirmation prompt is non-standard.
I'm talking about this particular passage:
echo "Install $docset docset" | xargs -p | grep -q . || continue # confirm
The current prompt feels noninformative and makes no mention that "something" is required for the answer to be positive.
You should adopt the commonly used Do thing? [Y/n]
style. The capital Y
means that an empty response will default to "yes". If appropriate, you can also use [y/N]
, where the empty response would default to "no".
I haven't checked, but if there are other prompts in your code, please do the same about them.
I personally use the following function, which is written for ZSH, but it serves to illustrate:
function confirm()
{
echo -n "$@ [y/N] "
read answer
for response in y Y yes YES Yes Sure sure SURE OK ok Ok kk; do
[[ "_$answer" == "_$response" ]] && return 0
done
return 1
}
Just for illustration purposes, a positive-default version:
function negate()
{
echo -n "$@ [Y/n] "
read answer
for response in n no No NO nope omgno; do
[[ "_$answer" == "_$response" ]] && return 1
done
return 0
}
Usage as follows:
confirm "Do thing?" && do_thing
Hi!
I'm trying to write a PKGBUILD for arch linux, and I need something to use for the package version. Could you please tag a release so I can use that?
I installed rust
docset via: dasht-docsets-install Rust
I notice it include rust guide and search through, but how to open rust root guide like open firefox with url: https://doc.rust-lang.org/book/?
I want to issue dasht <something> rust
and it open the rust book as open https://doc.rust-lang.org/book/
in firefox, howto?
It would be nice to be able to use fzf
to select a docset instead of using w3m
.
Option to create dasht docsets from previously installed docsets would be nice. Can someone guide what exactly is required for that to work?
When running dasht-docsets-install python3
I get the following error:
--2021-01-02 12:25:56-- https://api.github.com/repos/Kapeli/feeds/git/trees/
Resolving api.github.com (api.github.com)... 140.82.121.5
Connecting to api.github.com (api.github.com)|140.82.121.5|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-01-02 12:25:56 ERROR 404: Not Found.
Installable docsets (0):
Installing Bash with dasht-docsets-install bash
worked fine.
Dear dasht users, π
URI fragments allow us to jump directly π― to the relevant piece of documentation we're interested in. However, not all docsets provide them, as indicated by all the "FIXME" notes visible on this linked page. π± And even among those that do provide them, they do so only partially or in an inconsistent manner. πΏ
The good news is that they can be emitted quite easily πΆ by the respective software that generates API docsets. πΊ To achieve this, π I need your help: look through the "FIXME" notes in the page linked above and ask the creator of that docset to provide URI fragments for it. π Of course, you'll get bonus karma π for sending them a pull request that patches in URI fragment emission into their API docset generator. π
Thanks for your consideration. πββοΈ
Hi,
I've just install dasht with Homebrew in macOS Catalina. Searching within dasht
works great, I can navigate through all the docsets I've installed real quick.
However, when I run dash-server
and use the URL in Firefox, it renders a blank page. It also happens in Safari. I even try with the suggested code from man page dasht-server | xargs -n1 w3m
and it also directs to a black page in terminal.
Should I install everything that I'm missing to get the functionality?
Thank you in advance!
Is it possible to install cheatsheets using dasht-docsets-install
or it must be done manually?
I would like to add dasht installation to the scripts I use to build a new machine. Currently this would be fiddly as I would have to keep updating this script when a new version is released.
The wget dependency prevents the installation of dasht in Homebrew:
bash-3.2$ brew install dasht
Error: dasht contains conflicting version recursive dependencies:
openssl, [email protected]
View these with `brew deps --tree dasht`.
bash-3.2$ brew deps --tree dasht
dasht
βββ sqlite
β βββ readline
βββ socat
β βββ readline
β βββ openssl
βββ wget
β βββ [email protected]
βββ w3m
βββ bdw-gc
βββ openssl
The best remedy here would be for dasht to use the system curl on macOS rather than wget.
Feature: dasht
should be able to re-use docsets from existing Zeal and Dash installations.
Dash allows users to contribute docsets, as outlined in zealdocs/zeal#170. dasht should provide a command to automatically download and extract these as well.
(See also #4.)
dasht-server
is converting single straight quotes into encoded apostrophes:
https://github.com/sunaku/dasht/blob/master/bin/dasht-server-http#L57
'Vanilla' dasht
in the shell knows how to handle these. For example, you can get:
xdescribe Jasmine method
Describing Hooks Mocha guide
However, vim-dasht
on Neovim does not. Instead, you get:
'xdescribe' Jasmine method
'Describing Hooks' Mocha guide
I can think of several ways of fixing this, but I'm raising the issue on this repo (vs on vim-dasht
) as the simplest solution surely would be to just not encode those straight single quotes.
Thoughts?
I'm trying to install apple guides and sample code which is the updated version of swift docs, but can't install it successfully.
It always complains "mv: rename /Users/dr_selump14/.local/share/dasht/docsets/ to /Users/dr_selump14/.local/share/dasht/docsets/Apple_Guides_and_Sample_Code.docset: Invalid argument"
Do you have any idea to fix this? thanks
When running the command dasht-docsets-install express
And pressing yes, I get the error specified in the title.
I'm using the latest master version (26ced75)
After bisecting (with rm ~/.local/share/dasht/docsets/Express.* -rf ; dasht-docsets-install express
), I found out the first bad commit : 5408885
I don't have any of the XDG env variables set ( env | grep --color -E 'XDG' | wc -l
returns 0)
after dasht-server started I can search in the browser just fine, but when I click the search results it does not open the URLs. Chrome says "Not allowed to load local resource: "
I noticed this fragment of code, fairly attributed to a GPL project:
Lines 48 to 59 in 7877d99
As far as I know, GPL is "viral", in that if a project (such as dasht) uses a fragment of GPL-licensed code, this makes the project a derived work based on the GPL-licensed fragment - and per the GPL license, this requires the derived project to be also distributed under GPL license. I believe you should mention this clearly in the "licensing" section of the dasht readme. I believe it's OK for the rest of the code to be licensed differently, so that any other parts of the code can be reused under that license, if taken without the GPL parts. But any copy of this (dasht) project that contains any GPL code, I believe must still be distributed in accordance with GPL license terms, and marked as such; I believe the license also requires that certain files (e.g. the full text of the GPL license) to be present in the project, see e.g.: https://www.gnu.org/licenses/gpl-faq.en.html#WhyMustIInclude
Is there a way to use dasht to download kapeli's third party docs? Such as Hexdocs.pm?
I'm trying but with no success.
(Congrats anyway though, this is an excellent little app :) )
C
docsets can't be loaded, I use text-based web browser w3m
to surf dasht-server
.
I really like this project.
One quick question : When I try a ./dasht,
I get the error Error : too many options: "-line" .
The version of sqlite3 I am using is 3.7.9 2011-11-01 00:52:41.
It looks like swapping the "$@" to be the first parameter of the sqlite3 command fixes this issue ( in the dasht-exec-query" ).
I installed the .Net Framework documentation:
$ dasht-docsets
NET Framework
They did not include FSharp documentation, so I tried to remove them:
$ dasht-docsets-remove
Removable docsets (2):
NET, Framework
echo Remove NET docset [y/N] ?...
echo Remove Framework docset [y/N] ?...
The space in the NET Framework.docset
directory seems to be the culprit.
Great tool, since I prefer the terminal, much better match for me than Zeal :)
But I think the installer could use a few improvements, firstly smart-case search (case-sensitive as soon as there are uppercase-characters):
β― dasht-docsets-install Rails
--2023-02-02 13:28:55-- https://api.github.com/repos/Kapeli/feeds/git/refs/heads/master
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving api.github.com (api.github.com)... 140.82.121.5
Connecting to api.github.com (api.github.com)|140.82.121.5|:443... connected.
HTTP request sent, awaiting response... 304 Not Modified
File β/home/janek/.local/cache/dasht/masterβ not modified on server. Omitting download.
--2023-02-02 13:28:55-- https://api.github.com/repos/Kapeli/feeds/git/trees/7a8c0a2e886b4f379111cf55dd8a702ef2e5927e
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving api.github.com (api.github.com)... 140.82.121.5
Connecting to api.github.com (api.github.com)|140.82.121.5|:443... connected.
HTTP request sent, awaiting response... 304 Not Modified
File β/home/janek/.local/cache/dasht/7a8c0a2e886b4f379111cf55dd8a702ef2e5927eβ not modified on server. Omitting download.
Installable docsets (6):
Grails, Ruby_on_Rails_3, Ruby_on_Rails_4, Ruby_on_Rails_5, Ruby_on_Rails_6, Ruby_on_Rails_7
echo Install Grails docset '[y/N]'?...^C%
Furthermore, I do not understand why there is a listing of all files in the docset upon installation.
If you want to show progress, maybe you want something like this: https://code.ftt.gmbh/janek/dotfiles/src/branch/main/.local/bin/scripts/rewrite
As a MacOS user, I do not want to install wget
. It would be helpful for some kind of check to see if wget and/or curl is installed, then use the appropriate binary already on the system
I'm already using Dash.app and have various docsets installed, so I figured I'd point dasht
at my existing docsets with DASHT_DOCSETS_DIR
. Unfortunately:
$ export DASHT_DOCSETS_DIR=~/Library/Application\ Support/Dash/DocSets
$ dasht-docsets # nothing is output
$ export DASHT_DOCSETS_DIR=~/Library/Application\ Support/Dash/DocSets/Ruby_2
$ dasht-docsets
Ruby
In other words, Dash.app puts the actual Something.docset
directories a layer further down, inside language-specific subdirectories of the general DocSets
directory. dasht
does not anticipate this extra layer and does not understand it, hence it finds no docsets.
Could dasht
be taught to look for docsets recursively from the configured docsets dir, to make it compatible with the organisation Dash.app uses?
I installed dasht through homebrew, however, I find that the dasht-server links do nothing. For example, the link for numpy.add
points to file:///Users/myusername/.local/share/dasht/docsets/NumPy.docset/Contents/Resources/Documents/doc/reference/generated/numpy.add.html#//apple_ref/Method/numpy.add
. If I manually remove everything after and including the #
from this then I am sent to the correct page.
First off, thank you for the awesome application this is such a lifesaver. The problem I'm having is that I can download the docsets and they load up but whenever I try to load a page that is either a section or a guide I'm running into trouble.
E.g. I download the Django docs and search for migrations:
$ dasht 'migration' django
Near the bottom is an item named "Writing database migrations" and when I try to open it I get the following error:
Can't load file:///home/thorny/.local/share/dasht/docsets/Django.docset/Contents/Resources/Documents/<dash_entry_menuDescription=howto/writing-migrations><dash_entry_name=Writing%20database%20migrations>doc/howto/writing-migrations.
I'm sure it would go longer but I can't see the end. I can go to the docs directory and find the file at
/home/thorny/.local/share/dasht/docsets/Django.docset/Contents/Resources/Documents/doc/howto/writing-migrations.html
So I know it's there but it looks like an error in the link? It isn't limited to the django docs either I also get them in the python3 docs. It seems to be occuring for guides and sections.
When I do :
dasht-docsets-install -f Express
Both Express and ExpressionEngine are installed.
Maybe we could introduce a flag --exact (-e) to tell dasht to only install exact matches (eg in my case, only Express, and not ExpressionEngine)
Thanks for this awesome plugin, this really improved my terminal based workflow.
I created a small zsh completion snippet. Maybe it is helpful.
https://gist.github.com/tmerse/851722c0c03cd442265ec523500c78c6
Created a pr for oh-my-zsh aswell.
Again, thanks for bringing dash to the linux commandline.
to run dasht I had to install package sqlite3 in APT for WSL Ubuntu.
You may want to specify it as a dependency/requirement in the README.
the verbose option -v
is not supported BSD rmdir (MacOS)
$ dasht-docsets-update
...
/.../Docker.docset/Contents/Resources/Documents/www.google-analytics.com/analytics.js
rmdir: illegal option -- v
usage: rmdir [-p] directory ...
Hi, I've just installed dasht on my computer, and it's awesome. But I've encountered some problems.
I'd like to open index.html
page first (e.g. ~/.local/share/dasht/docsets/Bash.docset/Contents/Resources/Documents/bash/index.html
) and then read docs by following the links in index.html
page , but it seems like the dasht
command only supports to search for pattern in docsets.
So I want to know is there a right way to do this?
It is really hard to script the instillation of multiple doc-sets without being able to pass the -y
.
I have tried setting up a script using expect
but was getting no-where and I imagine this would be fairly easy to implement?
Thoughts?
Cheers.
Could it be that there are issues with the C++ docset?
First of all there seems to be an issue with the regex matcher to download the docset:
Β» dasht-docsets-install c++
grep: repetition-operator operand invalid
And when I download + extract it manually I can succesfully start searching for things until I try to open a link:
Can't load file:///Users/username/.local/share/dasht/docsets/C++.docset/Contents/Resources/Documents/<dash_entry_name=assign><dash_entry_originalName=std%3A%3Avector%3A%3Aassign><dash_entry_menuDescription=std%3A%3Avector%3A%3Aassign>en.cppreference.com/w/cpp/container/vector/assign.html#toc
Am I doing something wrong?
I installed dasht using brew:
Β» brew info dasht
dasht: stable 2.2.0
Thanks for this nice project, doing as much as posible in the terminal is always awesome! π
I tried dasht
with the Python 3 docset. If I search for sys.argv
for example, dasht
finds sys.argv
but the link behind it navigates to the top of the sys
documentation page. Zeal jumps to the sys.argv
section instead. I think there is a missing #sys.argv
at the end of the found documentation URL. It this behavior docset dependent?
When I try to search on dasht using dasht 'server' rust
for example, then choose one of the link, press some spaces that expect to read some contents but it always end with this mesg:
The second edition of the book is no longer distributed with Rust's documentation.
If you came here via a link or web search, you may want to check out the current version of the book instead.
If you have an internet connection, you can find a copy distributed with Rust 1.30.
Why do we have this behavior?
When I use the dropdown menu, it enters ^C++$
that produces the error ^C++$ docsets not installed so vector not searched
.
This error does not appear when searching in the CMake docset for example.
I can workaround by patching :
$ git diff
diff --git a/bin/dasht-server-http b/bin/dasht-server-http
index 90211f1..5b4853b 100755
--- a/bin/dasht-server-http
+++ b/bin/dasht-server-http
@@ -181,7 +181,7 @@ cat <<HEADER
<label>in docsets
<select name="docsets">
<option value="" selected>matched $1 out of $3</option>
- $(echo "$docsets_menu" | awk -v were_any_ignored=$2 '{
+ $(echo "$docsets_menu" | sed 's/\+/\\+/g' | awk -v were_any_ignored=$2 '{
value = "^" $2 "$"
label = were_any_ignored && $1 ? "((( " $2 " )))" : $2
print "<option value=\"" value "\">" label "</option>"
Love what you've done with dasht - great concept!
Unfortunately, I haven't been able to test-drive it yet due to dasht-docsets-install
resulting in a 403 due to a RateLimit issue on the feeds url. Here's the full error:
β― dasht-docsets-install
HTTP/1.1 403 Forbidden
Server: GitHub.com
Date: Wed, 02 Jan 2019 07:47:12 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 247
Status: 403 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1546415757
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-GitHub-Request-Id: EC95:6FB3:2E874DD:76A2D0E:5C2C6C80
https://api.github.com/repos/Kapeli/feeds/git/refs/heads/master:
2019-01-02 02:47:12 ERROR 403: Forbidden.
HTTP/1.1 403 Forbidden
Server: GitHub.com
Date: Wed, 02 Jan 2019 07:47:12 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 247
Status: 403 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1546415757
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-GitHub-Request-Id: EC9A:6FB3:2E874E1:76A2D1F:5C2C6C80
https://api.github.com/repos/Kapeli/feeds/git/trees/%7Brefrefs/heads/masternode_idMDM6UmVmMTEyMzkyNzk6bWFzdGVyurlhttps//api.github.com/repos/Kapeli/feeds/git/refs/heads/masterobject%7Bf6640fea1ab1e9bd1544722cf3ac0ee1e9a7416ftypecommiturlhttps//api.github.com/repos/Kapeli/feeds/git/commits/f6640fea1ab1e9bd1544722cf3ac0ee1e9a7416f%7D%7D:
2019-01-02 02:47:12 ERROR 403: Forbidden.
The output includes the same block of text twice, although it's the result of running dasht-docsets-install
only once.
Running on macOS Mojave in fish shell. Have tested in bash with the same result.
When I try to use: dasht-server
I get the following response:
http://127.0.0.1:54321
/home/otis/Developer/dotfiles/vendor/dasht/bin/dasht-server-http: 81: shift: can't shift that many
2016/11/21 22:33:01 socat[28881] E write(6, 0x24d4870, 1294): Broken pipe
awk: write failure (Broken pipe)
awk: close failed on file /dev/stdout (Broken pipe)
Cheers.
Such as browsh?
dasht-docsets-update
failed with error
rm: /Users/frode/.local/share/dasht/docsets/TypeScript.docset/Contents/Resources/Documents/www.typescriptlang.org/docs/handbook/release: No such file or directory
supect the issue is caused by space in path
find www.typescriptlang.org/docs/handbook -type d -name 'release*'
www.typescriptlang.org/docs/handbook/release notes
www.typescriptlang.org/docs/handbook/release-notes
dasht 2.3.0 (MacOS)
After installing the Javascript docset ( dasht-docsets-install javascript)
I get the following error any time I run dasht (the error shows during 20ms, than my browser is launched as expected, but nothing in the Javascript docset can be loaded).
Do you know how I could inspect this ?
$ dasht-docsets-install bash ξ² β ξ² 16064 ξ² 12:49:14
--2016-05-29 12:49:14-- https://kapeli.com/docset_links
Resolving kapeli.com (kapeli.com)... 23.92.22.81
Connecting to kapeli.com (kapeli.com)|23.92.22.81|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 33140 (32K) [text/html]
Saving to: β/home/gregf/.local/share/dasht/docsets/docset_links.htmlβ
docset_links.html 100%[==================================================================================================>] 32.36K --.-KB/s in 0.08s
2016-05-29 12:49:15 (414 KB/s) - β/home/gregf/.local/share/dasht/docsets/docset_links.htmlβ saved [33140/33140]
sed: can't read /home/gregf/.local/share/dasht/docsets/docset_links: No such file or directory
Installable docsets (0):
This is related to #4. In Dash, there is the possibility to install a specific version of a docset (e.g.: Ruby 2.2.4 docset). Looking into the docset feeds, I can see that there is a <other-versions>
tag in (some) docset files (e.g.: the Ruby 2 docset), but I couldn't figure out how to retrieve pre-built specific versions.
One workaround β which would apply to #4 as well β would be to be able to import local docsets by looking in common places.
For instance, on OS X, Dash docsets are in "$HOME/Library/Application Support/Dash"
, and in there there is a "Versioned DocSets"
directory:
"$HOME/Library/Application Support/Dash/"
βββ "Cheat Sheets"
βββ "DocSets"
βββ "User Contributed"
βββ "Versioned DocSets"
βββ "Ruby 2 - DHDocsetDownloader"
βββ "2-2-4"
βββ "Ruby.docset"
Or maybe an additional configuration variable could be available to specify additional lookup paths.
I'm on ubuntu 22.04
I install by running
brew install dasht
I have not installed by using git, so I look in similar locations
ls ~/.linuxbrew/etc | grep zsh
ls ~/.local/etc/ | grep zsh
I can't find completions anywhere to source in my zsh setup.
dasht import python_2
Error: disk I/O error
Error: disk I/O error
dasht: 'import' not found in 1 docsets matching 'python_2'
I get above error when I have setup DASHT_DOCSETS_DIR as shared directory. If I unset it and then try to install python_2/3 docset, it gets installed in default location & searchable by dasht import python_2 command.
I've also tried setting up non shared directory DASHT_DOCSETS_DIR and it works fine.
Other docset, for example ansible,docker,NodeJS etc all works fine.
I am thinking it may be something in docset which is not right however couldn't figure it out.
Mouse scrolling in any page I load is very laggy. I do not have this problem when use mouse scrolling in regular man pages. Also, I using the spacebar and b keys to navigate seems normal and is not lagging for me.
I'm on OSX: 10.12.4 with dasht 2.1.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.