Code Monkey home page Code Monkey logo

qutil's Introduction

== ABOUT ==

qutil provides several different common utility
functionalities for use with Q programs.  These currently include:

* an option parsing facility as an alternative to .Q.opt
* a file loading facility based on a pathlist and supporting
  version numbers

== INSTALLATION == 

Unzip qutil to whichever location you desire.

If you plan on using the file loading facility you must add
the code in q.q to your Q installation's q.q

You can customize the environment variable used for the library
search path by changing the argument passed to that function
(it defaults to $QPATH). The environment variable can also
refer to multiple paths by separating them with colons.

Next, place or link the file qutil/lib/bootstrap.q into the path
specified by the environment variable used in q.q

As an example, if you have used the enviornment variable
QPATH and set QPATH to /home/user/qpath, with the qutil
project residing in /home/user/qpackages, you would want to
have a directory layout for /home/user/qpath alont these
lines:

/home/user/qpath/bootstrap.q -> /home/user/qpackages/qutil/lib/bootstrap.q
/home/user/qpath/qutil -> /home/user/qpackages/qutil/lib

You should also move or symlink qutil/lib into this path so
that it can be references by the code loading utility
functions.

Doing all this will cause the file qutil/lib/bootstrap.q to
be loaded and will expose the file loading functions. The
qutil library will also be exposed to the .utl.require and
.utl.load functions (such as .utl.load "qutil").

== TUTORIAL ==

Please see the project wiki on github for instructions on usage:
http://github.com/nugend/qutil/wiki

== LICENSE ==

This code is licensed under an MIT license.  See LICENSE for
the full text.

== MISC ==

While you are under no obligation to do so, if you have
changes to the code that you feel would be useful to others,
please contribute them back.  If you have suggestions,
please make them.  If you have found a bug, please report
it.

To run the tests in test_require, explicitly pass the test
files to the qspec runner.  This is because executable q
files were needed to properly test the code loading capacities
and the qspec runner tries to inadvertently load these files.

== CONTACT ==

Daniel Nugent 
[email protected]
http://github.com/nugend/qutil

qutil's People

Contributors

jordanarmstrong avatar nugend avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

qutil's Issues

Always resolve loading files to absolute path.

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.

init.q optional in one-file package

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:

file: $[not 11h ~ type key pkgInfo[`file];pkgInfo[`file];` sv pkgInfo[`file],`init.q];

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

Change API from .utl.addOpt to .utl.addFlag

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.

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.