Vidir: Difference between revisions

Content added Content deleted
m (clarify)
m (→‎{{header|Raku}}: twiddles)
Line 127: Line 127:
'''Positionals:'''
'''Positionals:'''
* '''path''', string, optional, defaults to the present directory (relative './').
* '''path''', string, optional, defaults to the present directory (relative './').
* '''filter''', string, optional, defaults to none. A regex assertion you can use to filter the returned file names. E.G. \.txt$ (filenames ending with .txt extension)
* '''filter''', string, optional, defaults to none. A regex assertion you can use to filter the returned file names. E.G. '''\.txt$''' (filenames ending with .txt extension)




Line 133: Line 133:
* '''-r''', recurse, flag, optional, default False. Recurse into nested directories and process those files as well.
* '''-r''', recurse, flag, optional, default False. Recurse into nested directories and process those files as well.
* '''-v''', verbose, flag, optional, default False. Be chatty about what is going on when making changes.
* '''-v''', verbose, flag, optional, default False. Be chatty about what is going on when making changes.
* '''--editor=whatever''' or '''--e=whatever''', string, optional, defaults the default text editor. Pass in a command name to specify a specific editor: (E.G. --editor=vim)
* '''--editor=whatever''' or '''--e=whatever''', string, optional, defaults the default text editor. Pass in a command name to specify a specific editor: (E.G. '''--editor=vim''')




Will get a list of all file names from the specified director(y|ies), put them in a temporary file and open the text file with the default (or specified) text editor.
Will get a list of all file names from the specified director(y|ies), put them in a temporary file and open the text file with the default (or specified) text editor.


Edit the file names or directory names, add files, remove files and save the text file; all of the modifications made to the text file will be applied to the file system.
Edit the file names or directory names in the text editor: add, remove, modify file names, then save the text file; all of the modifications made to the text file will be applied to the file system.


'''To edit a file name:''' Just edit the file name, extension, whatever. Warning! There is nothing preventing you from using characters in the file name which will make it difficult to open, modify or delete the file. You can screw yourself quite easily if you make an effort. With great power comes great responsibility. The foot cannon is primed and loaded.
'''To edit a file name:''' Just edit the file name, extension, whatever. '''Warning!''' There is nothing preventing you from using characters in the file name which will make it difficult to open, modify or delete the file. You can screw yourself quite easily if you make an effort. With great power comes great responsibility. The foot cannon is primed and loaded.


If you add a forward solidus (directory separator: /) to a filename, it will treat anything between separators as a directory name and WILL CREATE non-existent directories.
If you add a forward solidus (directory separator: '''/''') to a filename, it will treat anything between separators as a directory name and '''WILL CREATE''' non-existent directories.


'''To move a file:''' Edit the directory path. the file will be moved to the new path. Non-existing directories will be created.
'''To move a file:''' Edit the directory path. The file will be moved to the new path. Non-existing directories will be created.


'''To delete a file:''' Delete the entire line in the text file.
'''To delete a file:''' Delete the entire line (file name and identifier) in the text file.


'''To add a file:''' Add a new line with a unique integer (need not be in any order), one or more tabs, then the new file path/name may be a relative or absolute path.
'''To add a file:''' Add a new line with a unique integer (need not be in any order), one or more tabs, then the new file path/name. May be a relative or absolute path.


Notice that all of the above operations will fail if you lack sufficient permissions for the affected files or directories.
Notice that all of the above operations will fail to apply if you lack sufficient permissions for the affected files or directories.


<lang perl6>use Sort::Naturally;
<lang perl6>use Sort::Naturally;