BarecatShell#

class barecat.cli.shell.BarecatShell(archive_path, readonly=True)[source]#

Bases: cmd.Cmd

Interactive shell for barecat archives, similar to sqlite3.

Parameters:
  • archive_path (str)

  • readonly (bool)

Instance Methods#

do_cd(arg)

Change directory: cd [path]

do_pwd(arg)

Print working directory

do_ls(arg)

List directory contents: ls [-l] [-R] [path_or_glob]

do_lss(arg)

List with sequence summarization: lss [path]

do_tree(arg)

Show directory tree: tree [-L N] [-d] [path]

do_cat(arg)

Print file contents: cat <path>

do_head(arg)

Print first N bytes: head [-n N] <path>

do_stat(arg)

Show file/directory metadata: stat <path>

do_find(arg)

Find files like /usr/bin/find: find [path] [-name PAT] [-type f|d] [-size [+-]N] [-maxdepth N]

do_du(arg)

Show disk usage: du [-a] [-s] [-H] [-d N] [path]

do_lcd(arg)

Change local directory: lcd [path]

do_lpwd(arg)

Print local working directory

do_lls(arg)

List local directory: lls [path]

do_get(arg)

Extract file: get <archive_path> [local_dest]

do_mget(arg)

Extract files matching pattern: mget <pattern> [local_dest]

do_put(arg)

Add file to archive: put <local_path> [archive_path]

do_mput(arg)

Add files matching glob: mput <pattern> [archive_dir]

do_rm(arg)

Remove file from archive: rm <path>

do_mv(arg)

Rename/move file in archive: mv <old> <new>

do_info(arg)

Show archive info

do_sql(arg)

Execute SQL query or start SQL REPL: sql [query]

do_quit(arg)

Exit the shell

do_exit(arg)

Exit the shell

do_EOF(arg)

Exit on Ctrl-D

default(line)

Handle .commands and ! shell escape

completedefault(text, line, begidx, endidx)

Default completion handler.

emptyline()

Do nothing on empty line (don't repeat last command).

cmdloop([intro])

Command loop with Ctrl+C handling.

close()

Close the archive.