mik-laj commented on issue #6881: [AIRFLOW-6326] Sort cli commands and arg
URL: https://github.com/apache/airflow/pull/6881#issuecomment-570816359
 
 
   I think, we can sort using followng function:
   ```python
       @classmethod
       def sort_args(cls, args):
           def partition(pred, iterable):
               """
               Use a predicate to partition entries into false entries and true 
entries
               """
               t1, t2 = tee(iterable)
               return filterfalse(pred, t1), filter(pred, t2)
           positional, optional = partition(lambda x: 
cls.args[x].flags[0].startswith("-"), args)
           yield from positional
           yield from sorted(optional, key=lambda x: cls.args[x].flags[0])
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to