Command Line Interface (CLI)

Continuing the discussion from Can I see my todo’s across text files?:

I’ve just published a “1.0” version of FoldingText’s command line tool. It’s a work in progress, needing your feedback. Right now it can do two things:

  1. It can run a node path on some text and return the results.

  2. It can evaluate a javascript function that’s given a node tree created from some text. The API that can be used in this function is described in the “core” API section of the API documentation. IE node, tree, but not editor.

Update Version 1.1.0 now includes default modes and has an option to define your own modes.

Fantastic – this is working really well …

(For aliases or search paths, the installation, at least on my system, went to /usr/local/lib/node_modules/foldingtext/bin/ft )

HI, I used these instructions to install npm but I can’t get ft to run.

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh

My unix is novice level and I am getting when running ./ft

env: node: No such file or directory

Any ideas ?



If the full path on which ft has been installed is something like:


then ./ft would only find it if your current working directory

(revealed by the pwd command) is actually:


(which is not all that probable or desirable)

You either need to add the folder in which the ft CLI tool is installed to your unix search path, or write scripts in which you refer explicitly to the full path, or use a variable assigned to that path.

(see, for example, the use of the $PathToFT variable in this script:

Sorry but the unix is a bit beyond me, maybe I should wait for a UI for node searching when Jesse bring it in!

If I run env it brings up this


The ft executable does exist in there so why can’t I run it from there and drag onto Terminal the path of my FT document ? Is there an easy command I can type to get it working?

./ft “/Users/markbedish/Dropbox/Taskpaper/PROJECT\ FT\ Testing.txt.ft”
env: node: No such file or directory



Stepping back a bit, what are you aiming to do ?

TTBH not that much, just trying to understand about searching.

Taskpaper used to have a query language and I suppose that has been taken over by nodes. I would like to search a bunch of documents for matching tags and specific text, that sort of thing and perhaps some dates I had though the CLI command was a key into that area, but I have only had FT for 3 days so I need to do some more reading.

BTW, thanks very much for the amazing set of scripts which I have started looking into.


I also had some trouble getting this to install via npm. I remember it had some dependencies, which didn’t seem to install automatically. I have two machines and I ended up with the ft bin installed in two different locations on both machines because I was just doing a lot of trial and error trying to get it to work. Not sure if this is an NPM issue or something with the ft repo on npm …

Hello Derekvan how did you finally get to install via npm? I am having a hard time.

Hi Jesse,

Where can I find the command line tool for Folding Text?

Once you have installed

you can type

npm install foldingtext

at the command line.


( I have npm at /usr/local/bin/npm )

@complexpoint 's post should get you there. post again if that doesn’t do it.