
    Vhd(                     f    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d Zd Zd Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functiona`  
module: git_config
author:
  - Matthew Gamble (@djmattyg007)
  - Marius Gedminas (@mgedmin)
requirements: ['git']
short_description: Update git configuration
description:
  - The M(community.general.git_config) module changes git configuration by invoking C(git config). This is needed if you
    do not want to use M(ansible.builtin.template) for the entire git config file (for example because you need to change
    just C(user.email) in C(/etc/.git/config)). Solutions involving M(ansible.builtin.command) are cumbersome or do not work
    correctly in check mode.
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
options:
  list_all:
    description:
      - List all settings (optionally limited to a given O(scope)).
      - This option is B(deprecated) and will be removed from community.general 11.0.0. Please use M(community.general.git_config_info)
        instead.
    type: bool
    default: false
  name:
    description:
      - The name of the setting. If no value is supplied, the value will be read from the config if it has been set.
    type: str
  repo:
    description:
      - Path to a git repository for reading and writing values from a specific repo.
    type: path
  file:
    description:
      - Path to an adhoc git configuration file to be managed using the V(file) scope.
    type: path
    version_added: 2.0.0
  scope:
    description:
      - Specify which scope to read/set values from.
      - This is required when setting config values.
      - If this is set to V(local), you must also specify the O(repo) parameter.
      - If this is set to V(file), you must also specify the O(file) parameter.
      - It defaults to system only when not using O(list_all=true).
    choices: ["file", "local", "global", "system"]
    type: str
  state:
    description:
      - 'Indicates the setting should be set/unset. This parameter has higher precedence than O(value) parameter: when O(state=absent)
        and O(value) is defined, O(value) is discarded.'
    choices: ['present', 'absent']
    default: 'present'
    type: str
  value:
    description:
      - When specifying the name of a single setting, supply a value to set that setting to the given value.
      - From community.general 11.0.0 on, O(value) will be required if O(state=present). To read values, use the M(community.general.git_config_info)
        module instead.
    type: str
  add_mode:
    description:
      - Specify if a value should replace the existing value(s) or if the new value should be added alongside other values
        with the same name.
      - This option is only relevant when adding/replacing values. If O(state=absent) or values are just read out, this option
        is not considered.
    choices: ["add", "replace-all"]
    type: str
    default: "replace-all"
    version_added: 8.1.0
a  
- name: Add a setting to ~/.gitconfig
  community.general.git_config:
    name: alias.ci
    scope: global
    value: commit

- name: Add a setting to ~/.gitconfig
  community.general.git_config:
    name: alias.st
    scope: global
    value: status

- name: Remove a setting from ~/.gitconfig
  community.general.git_config:
    name: alias.ci
    scope: global
    state: absent

- name: Add a setting to ~/.gitconfig
  community.general.git_config:
    name: core.editor
    scope: global
    value: vim

- name: Add a setting system-wide
  community.general.git_config:
    name: alias.remotev
    scope: system
    value: remote -v

- name: Add a setting to a system scope (default)
  community.general.git_config:
    name: alias.diffc
    value: diff --cached

- name: Add a setting to a system scope (default)
  community.general.git_config:
    name: color.ui
    value: auto

- name: Add several options for the same name
  community.general.git_config:
    name: push.pushoption
    value: "{{ item }}"
    add_mode: add
  loop:
    - merge_request.create
    - merge_request.draft

- name: Make etckeeper not complaining when it is invoked by cron
  community.general.git_config:
    name: user.email
    repo: /etc
    scope: local
    value: 'root@{{ ansible_fqdn }}'
a  
config_value:
  description: When O(list_all=false) and value is not set, a string containing the value of the setting in name.
  returned: success
  type: str
  sample: "vim"

config_values:
  description: When O(list_all=true), a dict containing key/value pairs of multiple configuration settings.
  returned: success
  type: dict
  sample:
    core.editor: "vim"
    color.ui: "auto"
    alias.diffc: "diff --cached"
    alias.remotev: "remote -v"
)AnsibleModulec                     t        t        t        ddddd      t        d      t        d      t        d      t        dd	d
d	g      t        dg d      t        ddddg      t                     ddgddgddggdddgfdddgfgddggd      } | j                  dd      }| j                  }t        dddd      | _        |d   xs d}|d   dk(  }|d   xs d}|d   }|s|s|d   s| j                  d dd!       t        |      }t        ||      }|d"d#g}	|dk(  r&|	j                  d$       |	j                  |d          n|r|	j                  d%|z          t        |	      }
|d   r|
j                  d&       |r"|
j                  d'       |
j                  |       | j                  |
|d(      \  }}}|d   r |r|d)k(  rd*|v r| j                  ddi +       n(|d,k\  r#| j                  ||d-j                  |
      .       |j                         j                         }|d   r8i }|D ]  }|j!                  d/d0      \  }}|||<    | j                  dd|+       nd|s|s| j                  dd|r|d1   nd2       nD|r|s| j                  dd34       n,||v r(t#        |      d0k(  s|d
k(  r|s| j                  dd4       t        |	      }|r#|j                  d5       |j                  |       n6|j                  d%|z          |j                  |       |j                  |       | j$                  s/| j                  ||dd6      \  }}}|r| j                  |||.       |rg }n|d
k(  r||gz   }n|g}| j                  d7t        d-j                  |      t'        |      d-j                  |      t'        |      8      d9       y ):NFboolz11.0.0zcommunity.general)requiredtypedefaultremoved_in_versionremoved_from_collectionstr)r
   pathzreplace-alladd)r
   r   choices)filelocalglobalsystem)r
   r   presentabsent)list_allnamerepor   add_modescopestatevaluer   r   r   r   r   r   r   r   T)argument_specmutually_exclusiverequired_ifrequired_one_ofsupports_check_modegitC)LANGLC_ALLLC_MESSAGESLC_CTYPE r   zIf state=present, a value must be specified from community.general 11.0.0 on. To read a config value, use the community.general.git_config_info module instead.)versioncollection_nameconfigz
--includesz-fz--z-lz	--get-all)cwdexpand_user_and_vars   zunable to read config file)changedmsgconfig_values    )rcr2   cmd=   r   )r1   r2   config_valuezno setting to unset)r1   r2   z--unset-all)r.   ignore_invalid_cwdr/   zsetting changed)before_headerbeforeafter_headerafter)r2   diffr1   )r   dictget_bin_pathparamsrun_command_environ_update	deprecatedetermine_scopedetermine_cwdappendlistrun_command	exit_json	fail_jsonjoinrstrip
splitlinessplitlen
check_modebuild_diff_value)modulegit_pathrC   r   unset	new_valuer   r   r.   	base_args	list_argsr6   outerr
old_valuesr3   r   kvset_argsafter_valuess                        p/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/git_config.pymainrb      s0   5vuYa  |O  P5!6"6"ume]E[\E+PQE9y(>ST&	
 (0:w2G*V]I^_gx(fvh'
 %f-. #F& ""5$/H]]F )-#cs]`(aF%&>RD7Ox'Ew%2Ij!H6*+=a/	 	 	
 F#E
v
&C8\2I(	&YIj%''	sQV'WNRcjec	6RVY6YBbA	qBCSXXi-@A((*Jj 	!E;;sA&DAq M!	! 	BmLuBjZ]^`a	s,AB	j	 c*o&:h%>OY^B/ IH&x(	"++H#RWns+tS#:	U	!YK/!{
((8,#J/(+"<0	
   	    c                 $    | d   r| d   S | d   ryy)Nr   r   r*   r    )rC   s    ra   rF   rF     s!    gg	
	rc   c                 8    | syt        |       dk(  r| d   dz   S | S )N
r9   r   )rQ   )r   s    ra   rS   rS   '  s&    	UqQx$rc   c                 6    | dk(  r|d   S |d   r
|d   r|d   S y)Nr   r   r   /re   )r   rC   s     ra   rG   rG   0  s1    f~	
	vf~ rc   __main__N)
__future__r   r   r   r
   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   rb   rF   rS   rG   __name__re   rc   ra   <module>rr      sZ    A @HT8t
$ 5tn zF rc   