Skip to content

Commit

Permalink
Land #18386, Add a new lmkdir command
Browse files Browse the repository at this point in the history
Merge branch 'land-18386' into upstream-master
  • Loading branch information
bwatters-r7 committed Oct 30, 2023
2 parents ec3cf74 + 58176b6 commit ac6aa53
Showing 1 changed file with 23 additions and 0 deletions.
Expand Up @@ -90,6 +90,7 @@ def commands
'getwd' => 'Print working directory',
'lcat' => 'Read the contents of a local file to the screen',
'lcd' => 'Change local working directory',
'lmkdir' => 'Create new directory on local machine',
'lpwd' => 'Print local working directory',
'ls' => 'List files',
'lls' => 'List local files',
Expand Down Expand Up @@ -117,6 +118,7 @@ def commands
'getwd' => [COMMAND_ID_STDAPI_FS_GETWD],
'lcat' => [],
'lcd' => [],
'lmkdir' => [],
'lpwd' => [],
'ls' => [COMMAND_ID_STDAPI_FS_STAT, COMMAND_ID_STDAPI_FS_LS],
'lls' => [],
Expand Down Expand Up @@ -390,6 +392,27 @@ def cmd_lcd_tabs(str, words)
tab_complete_directory(str, words)
end

#
# Create new directory on local machine
#
def cmd_lmkdir(*args)
if (args.length == 0)
print_line("Usage: lmkdir </path/to/directory>")
return
end

args.each do |path|
begin
::FileUtils.mkdir_p(path)
print_line("Directory '#{path}' created successfully.")
rescue ::StandardError => e
print_error("Error creating #{path} directory: #{e}")
end
end


end

#
# Retrieve the checksum of a file
#
Expand Down

0 comments on commit ac6aa53

Please sign in to comment.