Go to file
kendfss 65d9244cab sorry 2021-08-12 20:12:42 +01:00
cns sorry 2021-08-12 20:12:42 +01:00
.gitignore first 2021-06-20 20:30:59 +01:00
readme.md sorry 2021-08-12 20:12:42 +01:00
requirements.txt first 2021-06-20 20:30:59 +01:00
setup.py sorry 2021-08-12 20:12:42 +01:00

readme.md

CNS

CNS (Central Nervous System) is a productivity oriented python environment which offers a REPL for file system management and navigation.

It essentially bundles relevant aspects of filey and sl4ng into a shell-like environment with some additional offerings built on the standard library.
You can customize it to fit your system/workflow by editing the env file.

why? because you're worth it. But also, I don't have internet access from my main station so I tend to use a lot of offline documentation/screencaps as reference material. But also, as cool as Pathlib is, the lack of search-ability (excluding grep - which isn't ideal for newbs, or particularly thorough) makes it a sub-optimal tool for the use cases laid out below.
how?

Usage

Start

This starts the REPL which *-imports all of the contents from the env file.

$ cns
Navigation
>>> pwd
Place(name=System32, dir=Windows)
>>> cd(os.path.expanduser('~'))
>>> pwd
Place(name=Me, dir=Users)
>>> downloads = Place('~') / "downloads" # accesible as "downs" in the REPL

By default, searches only look for files, but you can see the techniques for directory finding here

>>> show(downloads("term1 term2 term3 ... termN", exts='pdf md htm'))
search_result_1.md
search_result_2.htm
...
search_result_n.pdf
>>> show(downloads("term1 term2 term3 ... termN", threads=3)) # defaults to zero
search_result_1.ext
search_result_2.ext
...
search_result_n.ext

This constrains the search to a given depth of directory. Any argument lower than zero goes as deeply as possible.
The following indicates how only look in space corresponding to os.listdir(downloads.path)

>>> show(downloads("term1 term2 term3 ... termN", depth=0)) # defaults to zero

Examples

Scanning Source Files for useful info
>>> show(filter(filey.Scanner("File) Read(", case=True), filey.files(r"C:\Program Files\Go\src")))
C:\Program Files\Go\src\cmd\pack\pack_test.go 
C:\Program Files\Go\src\net\http\fs.go
C:\Program Files\Go\src\os\file.go
C:\Program Files\Go\src\runtime\race\testdata\mop_test.go
C:\Program Files\Go\src\testing\fstest\mapfs.go
  • First one did the trick 😉

Change Log

v 1.0.1

  • Adds
    • threaded searching
    • depth-controlled searching
    • globbing to Places
    • filey.files to repl