corporate-runaways / tooloo Goto Github PK
View Code? Open in Web Editor NEWCommand LookUp
License: Other
Command LookUp
License: Other
Having a lot of helpful scripts is great, but not having a way to share a listing of what you have with others sucks. Clu gives us a listing, but it's not in a particularly shareable way.
Goal: to output the results similar to clu list
in such a format that people can easily incorporate into the README of their dotfile repos.
New command
clu export <format>
Initially there will only be one supported format: markdown.
Markdown because that's what almost everyone uses for their Readme.
Since the database contains the source url of each script I think that the format should be as follows (still sorted alphabetically by script name)
| script name | description |
|------------------------------------|-------------------------------------------------|
|[script-name](https://example.com) | description text here which may be notably wide.|
|[next](https://example.com/1) | another description here |
Rather than taking the width from the terminal output it should just be calculated to fit the longest link in the first column and longest description in the second. This will be ridiculously wide, but that's ok, markdown tables are kinda crap, and it's not actually intended to be read in this format.
Output should be send to standard out. Users can always clu export markdown > my.md
Reminder to myself to change the license with the 2.0 version.
Why isn't CLU available in the Raku ecosystem?
Being able to say:
zef install CLU
would be much better, no?
We've got a database... why not stick the internationalization strings in it? Something like this...
key | lang | value |
---|---|---|
add | en | add |
add | eo | aldoni |
I've been using markdown in my description
blocks in v2, because it looks great when exported to a static blog, and is very readable when you run tooloo show <command>
But it would be much nicer if we had actual syntax highlighting like that provided by the following projects:
I don't believe there is currently a Raku library that provides this.
Check if glow is installed (Charm's cli wrapper around glamour), give it a tempfile to render, and insert the output into our output.
Port Glamor (or similar) to Raku, and use that.
There are many little scripts we can write that only apply for the creator. Either they'll only work on the creator's system, or they depend on other tools / creations that only the creator has.
You might also be documenting some common unix tool that has bad "man pages" and want to show up in tooloo.
Regardless of why, there is stuff that you'll document that you don't want to be included in statically generated sites or other future export forms.
This task is to add support for an exportable
flag in the TOML
given
is_brewed : indicates if a package is installed via homebrew
clu find homebrew
and clu find is_brewed
both return "No matches found"
fix this failing install ASAP. Note that this happens when doing zef install .
also. (as you'd expect)
===> Testing: TooLoo:ver<2.0.1>:auth<zef:masukomi>:api<2>
[TooLoo] # Failed test 'testing display-command'
[TooLoo] # at t/TooLoo/Command.rakutest line 51
[TooLoo] # expected: '┌───────────────────┬──────────────────────────────────────────────────────────────────────────────────┐
[TooLoo] # │ Attribute │ Detail │
[TooLoo] # ├───────────────────┼──────────────────────────────────────────────────────────────────────────────────┤
[TooLoo] # │ command │ ls │
[TooLoo] # │ short description │ lists the contents of directories │
[TooLoo] # │ │ │
[TooLoo] # │ full description │ a detailed description │
[TooLoo] # │ │ │
[TooLoo] # │ usage │ LS(1) General Commands Manual LS(1) │
[TooLoo] # │ │ │
[TooLoo] # │ │ NAME │
[TooLoo] # │ │ ls – list directory contents │
[TooLoo] # │ │ │
[TooLoo] # │ type │ executable │
[TooLoo] # │ language │ c │
[TooLoo] # │ location │ /bin/ls │
[TooLoo] # │ source repo │ https://github.com/wertarbyte/coreutils │
[TooLoo] # │ source url │ https://github.com/wertarbyte/coreutils/blob/master/src/ls.c │
[TooLoo] # │ tags │ cli, utility │
[TooLoo] # └───────────────────┴──────────────────────────────────────────────────────────────────────────────────┘
[TooLoo] # '
[TooLoo] # got: '┌───────────────────┬────────────────────────────────────────────────────────────────────────────────┐
[TooLoo] # │ Attribute │ Detail │
[TooLoo] # ├───────────────────┼────────────────────────────────────────────────────────────────────────────────┤
[TooLoo] # │ command │ ls │
[TooLoo] # │ short description │ lists the contents of directories │
[TooLoo] # │ │ │
[TooLoo] # │ full description │ a detailed description │
[TooLoo] # │ │ │
[TooLoo] # │ usage │ LS(1) General Commands Manual LS(1) │
[TooLoo] # │ │ │
[TooLoo] # │ │ NAME │
[TooLoo] # │ │ ls – list directory contents │
[TooLoo] # │ │ │
[TooLoo] # │ type │ executable │
[TooLoo] # │ language │ c │
[TooLoo] # │ location │ /bin/ls │
[TooLoo] # │ source repo │ https://github.com/wertarbyte/coreutils │
[TooLoo] # │ source url │ https://github.com/wertarbyte/coreutils/blob/master/src/ls.c │
[TooLoo] # │ tags │ cli, utility │
[TooLoo] # └───────────────────┴────────────────────────────────────────────────────────────────────────────────┘
[TooLoo] # '
[TooLoo] # You failed 1 test of 1
===> Testing [FAIL]: TooLoo:ver<2.0.1>:auth<zef:masukomi>:api<2>
When you need to load a bunch in it sucks, and is slower, to have to do this
find . -name '*.meta.toml' -exec clu add '{}' \; -exec sleep 1 \;
# sleep necessary because otherwise locked db complaints
There should be a way to point clu at a directory and have it ingest all the toml it finds in it or in any subdirectory.
There is, of course, the problem that there may be TOML files in there that aren't for clu.
To solve this i think we should:
clu ingest
command that checks if it's a directory, and mass-ingests if so, but if it's a path, just calls the ingest
method like clu add
does.
note("skipping /foo/bar.toml")
for files that aren't valid clu toml.asciinema is probably the best way to demonstrate the usage of any given command. it's files are stored in asciicast v2 format
asciicast_url
to the TOML ingestion
/foo/bar/baz.cast
file://foo/bar/baz.cast
/foo/bar/baz.cast
https://foo/bar/baz.cast
application/x-asciicast
but we shouldn't enforce that. I'm sure a lot of servers get it wrong.asciicast_url
is found in a toml
it will check if asciinema
support has been enabled, and .... ask the user if they want it enabled? ??? or just store the data?.cast
files separately
clu add path/to/my.cast
asciinema
support has been enabledclu demo <command>
functionality (see Playback below)clu list demos
functionality (see Playback below)For now, clu add
will only support local paths /path/to/my.cast
You can only add a web url via the .toml
(for now).
No clue how this should work since most commands probably won't have casts.
At the very least there should be an line in the clu show <command>
indicating that a "demo" is available.
I'm thinking something like clu demo <command>
and it invokes asciinema play /path/to/my.cast
if there's a demo (asciicast) for the specified command.
Skipped: However, IF the asciicast_url
is an http(s) url it'll just callopen <asciicast_url>
and load the web page.
👆 we can add that later.
If there isn't one it should say something like
There's no demo available for . Go here https://example.com/creating_demos.html to learn how to create one.
maybe there's a clu demos
command (plural demoS) which lists all the commands that have demos.
I'm open to suggestions .
Once we have support for markdown export we'll be able to link to an asciicast to demonstrate the use of the command.
This will likely have to wait until we have the ability to export a "readme" type page for every command.
I think we're going to end up in a situation where we're basically just generating pages for some static site generator. A custom index and then an individual page for every command. ... would be cool.
clu list would list all the command + description pairs.
The output should be columnular (sp? in columns) and sorted alphabetically by command.
then you could grep it or pipe it to other things.
Builds on, and is blocked by Issue #9 (adding initial support for tags)
Not terribly useful on the command line, this could be a nice-to-have for exporting to create web pages. This would enable web users to browse by tag.
Still, we'll start with the command line because it's the easiest way to implement the core functionality we'll need for the export.
I'm thinking clu list <tag>
as a way of invoking this, but am open to other suggestions.
we should allow users to specify an array of tags
in the TOML that can be used for searching.
tags
table (id, tag)commands_tags
table (command_id
, tag_id
) compound keyIngester
tags
columnexample SQL (untested of 1 of the 3 triggers)
note that SQLite uses ||
instead of the traditional CONCAT
function and GROUP_CONCAT for concatenating rows
CREATE TRIGGER commands_fts_update AFTER UPDATE ON commands
BEGIN
INSERT INTO commands_fts
(commands_fts, rowid, name, description, language, tags)
VALUES ('delete', old.rowid, old.name, old.description, old.language);
INSERT INTO commands_fts
(rowid, name, description, language)
(
SELECT GROUP_CONCAT(tag)
from tags where command_id = old.id
);
END;
given a usage_command
which returns a non-zero when called
the error at the end of this issue is raised.
stack trace from commit bc441b4
❯ clu show is_brewed
empty_database.db in resources? Nil
is_brewed : indicates if a package is installed via homebrew
Use of Nil in string context
in block at /Users/kayrhodes/workspace/Clu/lib/Clu/Command.rakumod (Clu::Command) line 163
Invalid attribute name 'on_'
in sub color at /usr/local/Cellar/rakudo-star/2022.07/share/perl6/vendor/sources/11AAE19828E79B2115B29C27C68926D3C4B029FB (Terminal::ANSIColor) line 54
in sub colored at /usr/local/Cellar/rakudo-star/2022.07/share/perl6/vendor/sources/11AAE19828E79B2115B29C27C68926D3C4B029FB (Terminal::ANSIColor) line 61
in sub display-fallback-usage at /Users/kayrhodes/workspace/Clu/lib/Clu/Command.rakumod (Clu::Command) line 163
in sub display-usage at /Users/kayrhodes/workspace/Clu/lib/Clu/Command.rakumod (Clu::Command) line 152
in sub display-command at /Users/kayrhodes/workspace/Clu/lib/Clu/Command.rakumod (Clu::Command) line 61
in sub display-command at /Users/kayrhodes/workspace/Clu/lib/Clu/Command.rakumod (Clu::Command) line 54
in sub MAIN at /Users/kayrhodes/bin/clu line 59
in block <unit> at /Users/kayrhodes/bin/clu line 53
the v2.0.0 db adds the clu_metadata
table which has a key
and value
column (both TEXT data type)
There should be a command that enables the setting of settings. I'm thinking
clu set <key> <value>
and a corresponding command to display all the metadata
clu metadata
(displays all the key value pairs)
This will be used, for a variety of things, but from a user facing perspective the first thing will be to toggle support for demos clu set demos true
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.