The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::Term::Jump - searcheable database of often visited directories

DESCRIPTION

A utility to navigate your filesystem. It can ither be used directly on the command line or integrated with Bash.

run(@command_line_arguments)

Entry point of the module; called by the jump script.

Arguments -

  • @command_line_arguments - options and values pased on the comman line

Returns -

  • $matches - list of matches for the passed options and values

  • $options - parsed options

Exceptions - invalid options

Note - May call exit

[p] execute_commands(\%options, \@command_line_arguments)

Called to execute commands after the command line is parsed

If multipe commands are given on the command line, jump will run them at the same time

Arguments -

  • \%options - options parsed from the command line

  • \@command_line_arguments - arguments parsed from the command line

Returns - An aray refeence - empty or the result of a search

[p] parse_command_line(@command_line_argumens)

Parses the command line and loads the configuration file

Arguments -

  • @command_line_arguments -

Returns -

  • \%options - options parsed from the command line

  • \@command_line_arguments - arguments parsed from the command line

Exceptions - invalid options

[p] get_config($config_location)

Parses a file that contains the default configuration

Arguments -

  • $config_location - a string - path to the configuraation file

Returns - A hash ref - configuration file with defualt values if they are not present in the file

Exceptions - On config evaluation errors

[p] complete(\%option, \@search_aguments)

Prints and returns all the matches for a set of search options

Arguments -

  • \%options - options parsed from the command line

  • \@search_arguments -

Returns - an array reference - an array containing all the matches

Exceptions - None

[p] _complete(\%options, \@search_arguments)

Returns all the matches for a set of search options

Arguments -

  • \%options - options parsed from the command line

  • \@search_arguments -

Returns - an array reference - an array containing all the matches

Exceptions - None

[p] search(\%options, \@search_arguments)

Prints the first match (truncated to the closes path) and returns all the matches for a set of search options

Arguments -

  • \%options - options parsed from the command line

  • \@search_arguments -

Returns - an array reference - an array containing all the matches

Exceptions - None

[p] print_matches(\%options, $field, \@matches)

Prints the field, selected by $field, for all the matches

Arguments -

  • \%options - options parsed from the command line

  • $field - an enum used to select which feld to print

  • \@smatches - an array containing matches

Returns - Nothing

Exceptions - None

[p] find_closest_match(\%options, $find_all, \@paths)

Searches the Jump database and the filesystem for matches to the paths

Arguments -

  • \%options - options parsed from the command line

  • $find_all - an enum - when set, the filesystem is also searches for matches

  • \@paths - elements of the query

Returns - An array reference containing the matches, empty if no matches are found

Exceptions - None

[p] directory_contains_file(\%options, \@directories)

Searches for $option-{file}> in each of the directories passees as argument

Arguments -

  • \%options - options parsed from the command line

  • \@directories - directoris to search

Returns - An array reference containing the directories containing a matching file

Exceptions - None

[p] get_path_weight(\@db, @directories)

Given the succesive directories of a path, finds and cumulates the weight of each directory

Arguments -

  • \@db - Jump database

  • @directories - directories of a single path to weight

Returns - A cumulated path weight

Exceptions - None

[p] remove(\%options, \@arguments)

Remove an entry from the database

Arguments -

  • \%options - options parsed from the command line

  • \@arguments - path, [weight] to be removed

Returns - Nothing

Exceptions - None

[p] add(\%options, \@arguments)

Add an entry to the database with the given weight, unless it is blacklisted.

Arguments -

  • \%options - options parsed from the command line

  • \@arguments - path, [weight] to be removed

Returns - Nothing

Exceptions - None

[p] remove_all(\%options, \@arguments)

Remove some or all entrie from the database.

Arguments -

  • \%options - options parsed from the command line

  • \@arguments - path regext array, if empty, all entries are removed

Returns - Nothing

Exceptions - None

[p] show_database(\%options)

Prints out the database.

Arguments -

  • \%options - options parsed from the command line

Returns - Nothing

Exceptions - None

[p] show_configuration_files(\%options)

Prints out the database and the configuration locations.

Arguments -

  • \%options - options parsed from the command line

Returns - Nothing

Exceptions - None

[p] show_version()

Prints out the ons

s<Arguments> - None

Returns - Nothing

Exceptions - None

[p] read_db(\%options)

Reads a Jump database from disk.

Arguments -

  • \%options - options parsed from the command line

Returns - The database as a hash reference

Exceptions - Error readin the database

[p] write_db(\%options, \%db)

Reads a Jump database from disk.

Arguments -

  • \%options - options parsed from the command line

  • \%dbs - Jump database

Returns - Noting

Exceptions - Error writing the database

[p] check_weight_and_path($weight, $path)

Verifies its arguments, swapping them if necessary.

Arguments -

  • $weight - weight of the path to be worked on

  • $path - path to be worked on

Returns - tuple ($weight, $path)

Exceptions - None

[p] is_blacklisted(\%options, $path)

Verifies if the path can be added to the database or not

Arguments -

  • \%options - options parsed from the command line

  • $path - path to verify

Returns - True if the path can not be added to the database

Exceptions - None

[p] show_help()

Extracts the documentation and displays it via man

Arguments - None

Returns - Nothing

Exceptions - Exits the program

[p] do_bash_completion($index, $command, \@arguments)

Implements Bash completion for this modules.

Arguments received from bash:

  • $index - index of the command line argument to complete (starting at '1')

  • $command - a string containing the command name

  • \@arguments - list of the arguments typed on the command line