TREX
A TeRminal based file EXplorer.
Usage
Clean previous build if any
make clean
Compile
make
Run application
./trex
Exiting application
Return to normal mode by pressing ESC if currently in command mode.
Then press q to quit.
Assumptions
-
rename: assuming file path is relative to current directory
-
Ambiguity in
:goto
commands path- It's mentioned in the assignment pdf file that <directory_path> is relative to application root, but it was mentioned in moodle thread that it could also be relative.
- So I have assumed that a path with no leading '/' or '~/' is a path
relative to current directory.
i.e.,
~/A/B or /A/B
looks for the pathrelative to APP_ROOT
whereasA/B
looks for the path relative tocurrent directory
.
-
Similarly following path assumption have been made for the corresponding commands:-
- copy : directory name can be absolute or relative.
- move : directory name can be absolute or relative.
- rename : file with is present in current directory. No path should be specified
- create_file : directory name can be absolute or relative.
- create_folder : destination directory name can be absolute or relative.
- delete_file <file_path> : <file_path> is always relative to APP ROOT(as per assignment pdf) so no ~ or / as prefix is allowed
- delete_dir <directory_path> : <directory_path> is always relative to APP ROOT(as per assignment pdf) so no ~ or / as prefix is allowed
- goto <directory_path> : <directory_path> is relative to APP_ROOT
-
Directory copy: copy a.txt ~/B C will copy the file a.txt to directory C and directory B and all its contents into directory C i.e, now C will contain a directory named B.
- Both relative and absolute paths work.
-
Space in file names:
- User can enter space by quoting them with single or double quotes.
The only requirement is that the starting and ending quotes must match.
eg:
create_file "Abhinav's CV.txt" .
creates a new file namedAbhinav's CV.txt
in current directory
- User can enter space by quoting them with single or double quotes.
The only requirement is that the starting and ending quotes must match.
eg:
-
New file is created with permissions 0644 i.e., READ,WRITE for owner, READ for group, READ for others.
-
How to quit the application:
- Ctrl+C has been disabled in the application so that terminal settings are always restored before the application quits.
- This means the only way quit the application can be quit is by switching to normal mode and press q.
-
Deleting directory currently being shown in normal mode.
- what should happen?
- on linux it gets deleted.
- in TREX as well it will get deleted
- and when switching to the normal mode the user will be taken to home.
Known Issues
- Pressing ESC key application should go back to normal mode. (conflicts with the handling of Arrow Keys)
An arrow key is a combination of 'ESC','[' and 'A(for up arrow)')
- workaround:
- disable escape in normal mode
- allows scrolling using arrows
- enable escape in command mode
- allows switching to normal mode
- but can't use arrow keys in command mode.
- disable escape in normal mode
- workaround: