arara: How to widen out clean.yaml










5














I read the clean-rule for version 4.
% arara: clean: extensions: [aux, bcl ] deletes jobname.aux and jobname.bcl.



I would like to have a rule "cleanx.yaml" (or a shifter for clean.yaml), which deletes all files (*.aux and *.bcl) with the named extensions.



How can I do that? I tried concat('*') for 'base', but this does not work.



!config
# Arara, the cool TeX automation tool
# Copyright (c) 2018, Paulo Roberto Massa Cereda
# All rights reserved.
#
# This rule is part of arara.
identifier: clean
name: Clean
authors:
- Marco Daniel
- Paulo Cereda
commands:
- name: Cleaning feature
command: >
@
prefix = ;
if (isUnix())
prefix = [ 'rm', '-f' ];

else
prefix = [ 'cmd', '/c', 'del' ];

if (extensions == '')
if (getOriginalFile() == file)
throwError('I cannot remove the main file reference.');

return getCommand(prefix, file);

else
base = getBasename(file);
removals = ;
foreach(extension : extensions)
if (base.concat('.').concat(extension) == getOriginalFile())
throwError('I cannot remove the main file reference.');

removals.add(getCommand(prefix, base.concat('.').concat(extension)));

return removals;


arguments:
- identifier: extensions
flag: >
@
if (isList(parameters.extensions))
return parameters.extensions;

else
throwError('I was expecting a list of extensions.');











share|improve this question




























    5














    I read the clean-rule for version 4.
    % arara: clean: extensions: [aux, bcl ] deletes jobname.aux and jobname.bcl.



    I would like to have a rule "cleanx.yaml" (or a shifter for clean.yaml), which deletes all files (*.aux and *.bcl) with the named extensions.



    How can I do that? I tried concat('*') for 'base', but this does not work.



    !config
    # Arara, the cool TeX automation tool
    # Copyright (c) 2018, Paulo Roberto Massa Cereda
    # All rights reserved.
    #
    # This rule is part of arara.
    identifier: clean
    name: Clean
    authors:
    - Marco Daniel
    - Paulo Cereda
    commands:
    - name: Cleaning feature
    command: >
    @
    prefix = ;
    if (isUnix())
    prefix = [ 'rm', '-f' ];

    else
    prefix = [ 'cmd', '/c', 'del' ];

    if (extensions == '')
    if (getOriginalFile() == file)
    throwError('I cannot remove the main file reference.');

    return getCommand(prefix, file);

    else
    base = getBasename(file);
    removals = ;
    foreach(extension : extensions)
    if (base.concat('.').concat(extension) == getOriginalFile())
    throwError('I cannot remove the main file reference.');

    removals.add(getCommand(prefix, base.concat('.').concat(extension)));

    return removals;


    arguments:
    - identifier: extensions
    flag: >
    @
    if (isList(parameters.extensions))
    return parameters.extensions;

    else
    throwError('I was expecting a list of extensions.');











    share|improve this question


























      5












      5








      5


      1





      I read the clean-rule for version 4.
      % arara: clean: extensions: [aux, bcl ] deletes jobname.aux and jobname.bcl.



      I would like to have a rule "cleanx.yaml" (or a shifter for clean.yaml), which deletes all files (*.aux and *.bcl) with the named extensions.



      How can I do that? I tried concat('*') for 'base', but this does not work.



      !config
      # Arara, the cool TeX automation tool
      # Copyright (c) 2018, Paulo Roberto Massa Cereda
      # All rights reserved.
      #
      # This rule is part of arara.
      identifier: clean
      name: Clean
      authors:
      - Marco Daniel
      - Paulo Cereda
      commands:
      - name: Cleaning feature
      command: >
      @
      prefix = ;
      if (isUnix())
      prefix = [ 'rm', '-f' ];

      else
      prefix = [ 'cmd', '/c', 'del' ];

      if (extensions == '')
      if (getOriginalFile() == file)
      throwError('I cannot remove the main file reference.');

      return getCommand(prefix, file);

      else
      base = getBasename(file);
      removals = ;
      foreach(extension : extensions)
      if (base.concat('.').concat(extension) == getOriginalFile())
      throwError('I cannot remove the main file reference.');

      removals.add(getCommand(prefix, base.concat('.').concat(extension)));

      return removals;


      arguments:
      - identifier: extensions
      flag: >
      @
      if (isList(parameters.extensions))
      return parameters.extensions;

      else
      throwError('I was expecting a list of extensions.');











      share|improve this question















      I read the clean-rule for version 4.
      % arara: clean: extensions: [aux, bcl ] deletes jobname.aux and jobname.bcl.



      I would like to have a rule "cleanx.yaml" (or a shifter for clean.yaml), which deletes all files (*.aux and *.bcl) with the named extensions.



      How can I do that? I tried concat('*') for 'base', but this does not work.



      !config
      # Arara, the cool TeX automation tool
      # Copyright (c) 2018, Paulo Roberto Massa Cereda
      # All rights reserved.
      #
      # This rule is part of arara.
      identifier: clean
      name: Clean
      authors:
      - Marco Daniel
      - Paulo Cereda
      commands:
      - name: Cleaning feature
      command: >
      @
      prefix = ;
      if (isUnix())
      prefix = [ 'rm', '-f' ];

      else
      prefix = [ 'cmd', '/c', 'del' ];

      if (extensions == '')
      if (getOriginalFile() == file)
      throwError('I cannot remove the main file reference.');

      return getCommand(prefix, file);

      else
      base = getBasename(file);
      removals = ;
      foreach(extension : extensions)
      if (base.concat('.').concat(extension) == getOriginalFile())
      throwError('I cannot remove the main file reference.');

      removals.add(getCommand(prefix, base.concat('.').concat(extension)));

      return removals;


      arguments:
      - identifier: extensions
      flag: >
      @
      if (isList(parameters.extensions))
      return parameters.extensions;

      else
      throwError('I was expecting a list of extensions.');








      arara






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 16:12

























      asked Nov 12 '18 at 14:23









      cis

      690515




      690515




















          1 Answer
          1






          active

          oldest

          votes


















          5














          This new rule might do exactly what you want. However, be mindful to use it with great care!



          File cleanx.yaml:



          !config
          identifier: cleanx
          name: CleanX
          authors:
          - Paulo Cereda
          commands:
          - name: Cleaning feature
          command: >
          @
          prefix = ;
          if (isUnix())
          prefix = [ 'rm', '-f' ];

          else
          prefix = [ 'cmd', '/c', 'del' ];

          if (extensions == '')
          if (getOriginalFile() == file)
          throwError('I cannot remove the main file reference.');

          return getCommand(prefix, file);

          else
          directory = getOriginalReference().getAbsoluteFile().getParent();
          matches = listFilesByExtensions(directory, extensions, recursive);
          removals = ;
          foreach(match : matches)
          if (match.equals(getOriginalReference()))
          throwError('I cannot remove the main file reference.');

          removals.add(getCommand(prefix, match));

          return removals;


          arguments:
          - identifier: extensions
          flag: >
          @
          if (isList(parameters.extensions))
          return parameters.extensions;

          else
          throwError('I was expecting a list of extensions.');


          - identifier: recursive
          flag: >
          @
          return isTrue(parameters.recursive);

          default: false


          Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive and provide a natural boolean value such as true or yes.



          A quick experiment. My file header:



          % arara: cleanx: extensions: [ aux ] 


          Terminal usage:



          $ touch foo.aux bar.aux
          $ arara -n test.tex
          __ _ _ __ __ _ _ __ __ _
          / _` | '__/ _` | '__/ _` |
          | (_| | | | (_| | | | (_| |
          __,_|_| __,_|_| __,_|

          Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
          12:41:56), please wait.

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/foo.aux ]

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/bar.aux ]

          Total: 0.19 seconds





          share|improve this answer




















          • Works fine.... ;)
            – cis
            Nov 12 '18 at 14:53










          • @cis Yaaay! :)
            – Paulo Cereda
            Nov 12 '18 at 14:54










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "85"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459627%2farara-how-to-widen-out-clean-yaml%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          This new rule might do exactly what you want. However, be mindful to use it with great care!



          File cleanx.yaml:



          !config
          identifier: cleanx
          name: CleanX
          authors:
          - Paulo Cereda
          commands:
          - name: Cleaning feature
          command: >
          @
          prefix = ;
          if (isUnix())
          prefix = [ 'rm', '-f' ];

          else
          prefix = [ 'cmd', '/c', 'del' ];

          if (extensions == '')
          if (getOriginalFile() == file)
          throwError('I cannot remove the main file reference.');

          return getCommand(prefix, file);

          else
          directory = getOriginalReference().getAbsoluteFile().getParent();
          matches = listFilesByExtensions(directory, extensions, recursive);
          removals = ;
          foreach(match : matches)
          if (match.equals(getOriginalReference()))
          throwError('I cannot remove the main file reference.');

          removals.add(getCommand(prefix, match));

          return removals;


          arguments:
          - identifier: extensions
          flag: >
          @
          if (isList(parameters.extensions))
          return parameters.extensions;

          else
          throwError('I was expecting a list of extensions.');


          - identifier: recursive
          flag: >
          @
          return isTrue(parameters.recursive);

          default: false


          Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive and provide a natural boolean value such as true or yes.



          A quick experiment. My file header:



          % arara: cleanx: extensions: [ aux ] 


          Terminal usage:



          $ touch foo.aux bar.aux
          $ arara -n test.tex
          __ _ _ __ __ _ _ __ __ _
          / _` | '__/ _` | '__/ _` |
          | (_| | | | (_| | | | (_| |
          __,_|_| __,_|_| __,_|

          Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
          12:41:56), please wait.

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/foo.aux ]

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/bar.aux ]

          Total: 0.19 seconds





          share|improve this answer




















          • Works fine.... ;)
            – cis
            Nov 12 '18 at 14:53










          • @cis Yaaay! :)
            – Paulo Cereda
            Nov 12 '18 at 14:54















          5














          This new rule might do exactly what you want. However, be mindful to use it with great care!



          File cleanx.yaml:



          !config
          identifier: cleanx
          name: CleanX
          authors:
          - Paulo Cereda
          commands:
          - name: Cleaning feature
          command: >
          @
          prefix = ;
          if (isUnix())
          prefix = [ 'rm', '-f' ];

          else
          prefix = [ 'cmd', '/c', 'del' ];

          if (extensions == '')
          if (getOriginalFile() == file)
          throwError('I cannot remove the main file reference.');

          return getCommand(prefix, file);

          else
          directory = getOriginalReference().getAbsoluteFile().getParent();
          matches = listFilesByExtensions(directory, extensions, recursive);
          removals = ;
          foreach(match : matches)
          if (match.equals(getOriginalReference()))
          throwError('I cannot remove the main file reference.');

          removals.add(getCommand(prefix, match));

          return removals;


          arguments:
          - identifier: extensions
          flag: >
          @
          if (isList(parameters.extensions))
          return parameters.extensions;

          else
          throwError('I was expecting a list of extensions.');


          - identifier: recursive
          flag: >
          @
          return isTrue(parameters.recursive);

          default: false


          Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive and provide a natural boolean value such as true or yes.



          A quick experiment. My file header:



          % arara: cleanx: extensions: [ aux ] 


          Terminal usage:



          $ touch foo.aux bar.aux
          $ arara -n test.tex
          __ _ _ __ __ _ _ __ __ _
          / _` | '__/ _` | '__/ _` |
          | (_| | | | (_| | | | (_| |
          __,_|_| __,_|_| __,_|

          Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
          12:41:56), please wait.

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/foo.aux ]

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/bar.aux ]

          Total: 0.19 seconds





          share|improve this answer




















          • Works fine.... ;)
            – cis
            Nov 12 '18 at 14:53










          • @cis Yaaay! :)
            – Paulo Cereda
            Nov 12 '18 at 14:54













          5












          5








          5






          This new rule might do exactly what you want. However, be mindful to use it with great care!



          File cleanx.yaml:



          !config
          identifier: cleanx
          name: CleanX
          authors:
          - Paulo Cereda
          commands:
          - name: Cleaning feature
          command: >
          @
          prefix = ;
          if (isUnix())
          prefix = [ 'rm', '-f' ];

          else
          prefix = [ 'cmd', '/c', 'del' ];

          if (extensions == '')
          if (getOriginalFile() == file)
          throwError('I cannot remove the main file reference.');

          return getCommand(prefix, file);

          else
          directory = getOriginalReference().getAbsoluteFile().getParent();
          matches = listFilesByExtensions(directory, extensions, recursive);
          removals = ;
          foreach(match : matches)
          if (match.equals(getOriginalReference()))
          throwError('I cannot remove the main file reference.');

          removals.add(getCommand(prefix, match));

          return removals;


          arguments:
          - identifier: extensions
          flag: >
          @
          if (isList(parameters.extensions))
          return parameters.extensions;

          else
          throwError('I was expecting a list of extensions.');


          - identifier: recursive
          flag: >
          @
          return isTrue(parameters.recursive);

          default: false


          Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive and provide a natural boolean value such as true or yes.



          A quick experiment. My file header:



          % arara: cleanx: extensions: [ aux ] 


          Terminal usage:



          $ touch foo.aux bar.aux
          $ arara -n test.tex
          __ _ _ __ __ _ _ __ __ _
          / _` | '__/ _` | '__/ _` |
          | (_| | | | (_| | | | (_| |
          __,_|_| __,_|_| __,_|

          Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
          12:41:56), please wait.

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/foo.aux ]

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/bar.aux ]

          Total: 0.19 seconds





          share|improve this answer












          This new rule might do exactly what you want. However, be mindful to use it with great care!



          File cleanx.yaml:



          !config
          identifier: cleanx
          name: CleanX
          authors:
          - Paulo Cereda
          commands:
          - name: Cleaning feature
          command: >
          @
          prefix = ;
          if (isUnix())
          prefix = [ 'rm', '-f' ];

          else
          prefix = [ 'cmd', '/c', 'del' ];

          if (extensions == '')
          if (getOriginalFile() == file)
          throwError('I cannot remove the main file reference.');

          return getCommand(prefix, file);

          else
          directory = getOriginalReference().getAbsoluteFile().getParent();
          matches = listFilesByExtensions(directory, extensions, recursive);
          removals = ;
          foreach(match : matches)
          if (match.equals(getOriginalReference()))
          throwError('I cannot remove the main file reference.');

          removals.add(getCommand(prefix, match));

          return removals;


          arguments:
          - identifier: extensions
          flag: >
          @
          if (isList(parameters.extensions))
          return parameters.extensions;

          else
          throwError('I was expecting a list of extensions.');


          - identifier: recursive
          flag: >
          @
          return isTrue(parameters.recursive);

          default: false


          Note: this rule makes use of a helper method that searches from within the parent directory of the original reference. I also disabled recursive searches by default. However, one can enable it by using the directive parameter recursive and provide a natural boolean value such as true or yes.



          A quick experiment. My file header:



          % arara: cleanx: extensions: [ aux ] 


          Terminal usage:



          $ touch foo.aux bar.aux
          $ arara -n test.tex
          __ _ _ __ __ _ _ __ __ _
          / _` | '__/ _` | '__/ _` |
          | (_| | | | (_| | | | (_| |
          __,_|_| __,_|_| __,_|

          Processing 'test.tex' (size: 42 bytes, last modified: 11/12/2018
          12:41:56), please wait.

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/foo.aux ]

          [DR] (CleanX) Cleaning feature
          -----------------------------------------------------------------
          Author: Paulo Cereda
          About to run: [ rm, -f, /home/paulo/bar.aux ]

          Total: 0.19 seconds






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 '18 at 14:42









          Paulo Cereda

          33.2k8125208




          33.2k8125208











          • Works fine.... ;)
            – cis
            Nov 12 '18 at 14:53










          • @cis Yaaay! :)
            – Paulo Cereda
            Nov 12 '18 at 14:54
















          • Works fine.... ;)
            – cis
            Nov 12 '18 at 14:53










          • @cis Yaaay! :)
            – Paulo Cereda
            Nov 12 '18 at 14:54















          Works fine.... ;)
          – cis
          Nov 12 '18 at 14:53




          Works fine.... ;)
          – cis
          Nov 12 '18 at 14:53












          @cis Yaaay! :)
          – Paulo Cereda
          Nov 12 '18 at 14:54




          @cis Yaaay! :)
          – Paulo Cereda
          Nov 12 '18 at 14:54

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459627%2farara-how-to-widen-out-clean-yaml%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

          Museum of Modern and Contemporary Art of Trento and Rovereto