nugend / qutil Goto Github PK
View Code? Open in Web Editor NEWQ Utilities
License: MIT License
Q Utilities
License: MIT License
In a lean package with just a single file, there is no need for the boilerplate overhead of init.q
. At least, init.q
should be optional, not mandatory.
$ ls $QPATH/my-1.0.0
my.q
$ cat $QPATH/my-1.0.0/my.q
\d .my
This conditional statement:
Line 17 in 2bce9de
will resolve to false even for single-file directory:
q) key pkgInfo`file
,my.q
q) not 11h ~ type key pkgInfo`file
0b
Was it intended?
I propose changing the line to:
file:` sv f,$[f~k:key f:pkgInfo`file;();1=count k;first k;`init.q];
That will nicely cover all scenarios:
q).utl.require"my/my.q" / file loading scenario
q).utl.require"my" / dir loading scenario; supports single-file dir with or without init.q
They can't be read properly. Fix it.
Add the option to search for environment variables during name substitution:
java = %(JAVA_HOME)/bin/java
In this example
.utl.require "ln"
.utl.addOptDef["foo";"S";`bar;`foo];
.utl.parseArgs[];
show foo;
exit 0
If the program is called with "--foo" and no value is passed to the option, a command line error should occur.
In this example:
.utl.require "ln"
.utl.addOpt["foo,foobar";1b;`foo];
.utl.parseArgs[];
show foo;
exit 0
foobar cannot be used to set the flag
example fail-fast in qspec
In the history of the command line parser's development, addOpt
was created before addOptDef
and intended to support both command line flags that would take an argument as well as command line flags that toggled an option on or off.
After using the library for a long time, the addOptDef
is used far more often and addOpt
is actually confused by its capability of parsing a parameter. Consequently, I want to create addFlag
as a limited subset of addOpt
which only supports boolean flags and eventually remove addOpt
as it exists altogether.
Files can be reloaded if the first time a file is referred to, a relative path is used, but later a loaded file resolves a name through the global package namespace. On the second occurrence, an absolute path will be used to determine the file identity.
This could also be a problem if two sets of files are somehow loaded relatively and the same name is present in each set.
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.