Class BuckArgsMethods


  • public class BuckArgsMethods
    extends Object
    Utility class for methods related to args handling.
    • Method Detail

      • expandAtFiles

        public static com.google.common.collect.ImmutableList<String> expandAtFiles​(Iterable<String> args,
                                                                                    com.google.common.collect.ImmutableMap<CellName,​AbsPath> cellMapping)
        Expand AT-file syntax in a way that matches what args4j does. We have this because we'd like to correctly log the arguments coming from the AT-files and there is no way to get the expanded args array from args4j.

        In addition to files passed using a regular @ syntax, this method also extracts command line arguments from AT-file syntax files passed via --flagfile command line option.

        Parameters:
        args - original args array
        cellMapping - a map from cell names to their roots
        Returns:
        args array with AT-files expanded.
      • filterArgs

        public static com.google.common.collect.ImmutableList<String> filterArgs​(List<String> args,
                                                                                 com.google.common.collect.ImmutableSet<String> optionsToSkip)
        Drops options from the args array.
        Parameters:
        args - args array.
        optionsToSkip - if args contains an element from this array skip the element and the element immediately after it.
        Returns:
        filtered args array