
                         (    d Z ddlZddlmZ d Zd Zy)zThis package defines a few functions to add and parse platforms arguments.

These arguments are used to select the image to pull when given a Docker
manifest list.
    N)docker_image_listc                     | j                  dd       | j                  dd       | j                  ddd	       | j                  d
d       | j                  dd       | j                  ddd	       y)ziAdds command-line arguments for platform fields.

  Args:
    parser: argparser.ArgumentParser object.
  z--oszBFor multi-platform manifest lists, specifies the operating system.)helpz--os-versionzJFor multi-platform manifest lists, specifies the operating system version.z--os-features*zGFor multi-platform manifest lists, specifies operating system features.)nargsr   z--architecturezBFor multi-platform manifest lists, specifies the CPU architecture.z	--variantz=For multi-platform manifest lists, specifies the CPU variant.z
--featuresz:For multi-platform manifest lists, specifies CPU features.N)add_argument)parsers    9lib/third_party/containerregistry/tools/platform_args_.pyAddArgumentsr      s     	  
 	  
 	   	  
 	J  L 	G  I    c                     i fd} |d| j                           |d| j                          |d| j                          |d| j                          |d| j                          |d| j
                         t        j                        S )zEPopulates a docker_image_list.Platform object from the provided args.c                     ||| <   y y )N )kvps     r
   	_SetFieldzFromArgs.<locals>._SetFieldB   s    }ad r   osz
os.versionzos.featuresarchitecturevariantfeatures)r   
os_versionos_featuresr   r   r   r   Platform)argsr   r   s     @r
   FromArgsr   >   sx    ! D$''L$//*M4++,ND--.It||$J&		#	#A	&&r   )__doc__argparsecontainerregistry.client.v2_2r   r   r   r   r   r
   <module>r       s     ;"IJ'r   