This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efm2.

View the commit online.

commit bb1c514b41d71667749f3567e447ffe9ef27876b
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Sat Apr 4 13:34:59 2026 +0100

    typebuf - fill in mv and cp built-ins
---
 src/backends/default/typebuf.c | 90 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 82 insertions(+), 8 deletions(-)

diff --git a/src/backends/default/typebuf.c b/src/backends/default/typebuf.c
index 81a1b9b..b53e931 100644
--- a/src/backends/default/typebuf.c
+++ b/src/backends/default/typebuf.c
@@ -149,7 +149,7 @@ _common_complete_last_arg_dir_only(char **args)
 // ls
 static void
 _bi_ls_run(char **args)
-{
+{ // args: [dirname]
   if (_has_args(args, 1)) _typebuf_cd(args[1]);
   else
     {
@@ -168,7 +168,7 @@ _bi_ls_complete(char **args)
 // rm
 static void
 _bi_rm_run(char **args)
-{
+{ // args: [-f] file1 [file2 ...]
   int        i;
   Eina_List *files = NULL;
   char      *full  = NULL;
@@ -213,7 +213,7 @@ _bi_rm_complete(char **args)
 // unlink
 static void
 _bi_unlink_run(char **args)
-{
+{ // args: file1 [file2 ...]
   int        i;
   Eina_List *files = NULL;
   char      *full = NULL;
@@ -245,7 +245,45 @@ _bi_unlink_complete(char **args)
 // mv
 static void
 _bi_mv_run(char **args)
-{
+{ // args: filename newfilename
+  // args: filename1 [filename2 ...] destdir
+  int i;
+  char *lastarg = NULL, *full, *s;
+  Eina_Bool last_dir = EINA_FALSE;
+
+  if (!_has_args(args, 2)) return;
+  for (i = 1; args[i]; i++) lastarg = args[i];
+  full = _path_arg_rel_to_abs(lastarg);
+  if (!full) return;
+  if (ecore_file_is_dir(full)) last_dir = EINA_TRUE;
+  else if (ecore_file_exists(full)) goto err; // cant mv to existing file
+  if (last_dir)
+    { // last argument is a dir
+      Eina_List *files = NULL;
+
+      for (i = 1; args[i]; i++)
+        {
+          if (!args[i][0]) return; // empty string?
+          s = _path_arg_rel_to_abs(args[i]);
+          if (s) files = eina_list_append(files, s);
+        }
+      if (files) op_run("mv", files, full);
+      EINA_LIST_FREE(files, s) free(s);
+    }
+  else
+    { // rename a file
+      status_begin();
+      status_op("mv");
+      s = _path_arg_rel_to_abs(args[i]);
+      if (s)
+        {
+          fs_mv(s, full, EINA_TRUE);
+          free(s);
+        }
+      status_end();
+    }
+err:
+  free(full);
 }
 
 static void
@@ -258,7 +296,43 @@ _bi_mv_complete(char **args)
 // cp
 static void
 _bi_cp_run(char **args)
-{
+{ // args: filename newfilenme
+  // args: filename1 [filename2 ...] destdir
+  int       i;
+  char     *lastarg  = NULL, *full, *s;
+  Eina_Bool last_dir = EINA_FALSE;
+
+  if (!_has_args(args, 2)) return;
+  for (i = 1; args[i]; i++) lastarg = args[i];
+  full = _path_arg_rel_to_abs(lastarg);
+  if (!full) return;
+  if (ecore_file_is_dir(full)) last_dir = EINA_TRUE;
+  if (last_dir)
+    { // last argument is a dir
+      Eina_List *files = NULL;
+
+      for (i = 1; args[i]; i++)
+        {
+          if (!args[i][0]) return; // empty string?
+          s = _path_arg_rel_to_abs(args[i]);
+          if (s) files = eina_list_append(files, s);
+        }
+      if (files) op_run("cp", files, full);
+      EINA_LIST_FREE(files, s) free(s);
+    }
+  else
+    { // copy a file to another (new or on top)
+      status_begin();
+      status_op("cp");
+      s = _path_arg_rel_to_abs(args[i]);
+      if (s)
+        {
+          fs_cp(s, full, EINA_TRUE);
+          free(s);
+        }
+      status_end();
+    }
+  free(full);
 }
 
 static void
@@ -271,7 +345,7 @@ _bi_cp_complete(char **args)
 // ln
 static void
 _bi_ln_run(char **args)
-{
+{ // args: file_src symlink_file
   int        i;
   Eina_List *files = NULL;
   char      *full = NULL;
@@ -300,7 +374,7 @@ _bi_ln_run(char **args)
         { // do a link file op
           status_begin();
           status_op("ln");
-          fs_ln(link_src, link_file, EINA_FALSE);
+          fs_ln(link_src, link_file, EINA_TRUE);
           status_end();
         }
       EINA_LIST_FREE(files, full) free(full);
@@ -317,7 +391,7 @@ _bi_ln_complete(char **args)
 // cd
 static void
 _bi_cd_run(char **args)
-{
+{ // args: [dirname]
   if (_has_args(args, 1)) _typebuf_cd(args[1]);
   else
     { // no arg - go to $HOME

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to