@@ -1441,3 +1441,188 @@ def status(
14411441 ["status" , * local_flags , * (["--" , * pathspec ] if len (pathspec ) else [])],
14421442 check_returncode = False ,
14431443 )
1444+
1445+ def config (
1446+ self ,
1447+ replace_all : Optional [bool ] = None ,
1448+ get : Optional [str ] = None ,
1449+ get_all : Optional [bool ] = None ,
1450+ get_regexp : Optional [str ] = None ,
1451+ get_urlmatch : Optional [tuple [str , str ]] = None ,
1452+ system : Optional [bool ] = None ,
1453+ local : Optional [bool ] = None ,
1454+ worktree : Optional [bool ] = None ,
1455+ file : Optional [StrOrBytesPath ] = None ,
1456+ blob : Optional [str ] = None ,
1457+ remove_section : Optional [bool ] = None ,
1458+ rename_section : Optional [bool ] = None ,
1459+ unset : Optional [bool ] = None ,
1460+ unset_all : Optional [bool ] = None ,
1461+ _list : Optional [bool ] = None ,
1462+ fixed_value : Optional [bool ] = None ,
1463+ no_type : Optional [bool ] = None ,
1464+ null : Optional [bool ] = None ,
1465+ name_only : Optional [bool ] = None ,
1466+ show_origin : Optional [bool ] = None ,
1467+ show_scope : Optional [bool ] = None ,
1468+ get_color : Optional [Union [str , bool ]] = None ,
1469+ get_colorbool : Optional [Union [str , bool ]] = None ,
1470+ default : Optional [str ] = None ,
1471+ _type : Optional [
1472+ Literal ["bool" , "int" , "bool-or-int" , "path" , "expiry-date" , "color" ]
1473+ ] = None ,
1474+ edit : Optional [bool ] = None ,
1475+ no_includes : Optional [bool ] = None ,
1476+ includes : Optional [bool ] = None ,
1477+ add : Optional [bool ] = None ,
1478+ ** kwargs ,
1479+ ):
1480+ """Status of working tree. Wraps
1481+ `git status <https://git-scm.com/docs/git-status>`_.
1482+
1483+ `git ls-files` has similar params (e.g. `z`)
1484+
1485+ Parameters
1486+ ----------
1487+ replace_all : Optional[bool]
1488+ get : Optional[bool]
1489+ get_all : Optional[bool]
1490+ get_regexp : Optional[bool]
1491+ get_urlmatch : Optional[tuple[str, str]]
1492+ system : Optional[bool]
1493+ local : Optional[bool]
1494+ worktree : Optional[bool]
1495+ file : Optional[StrOrBytesPath]
1496+ blob : Optional[str]
1497+ remove_section : Optional[bool]
1498+ rename_section : Optional[bool]
1499+ unset : Optional[bool]
1500+ unset_all : Optional[bool]
1501+ _list : Optional[bool]
1502+ fixed_value : Optional[bool]
1503+ no_type : Optional[bool]
1504+ null : Optional[bool]
1505+ name_only : Optional[bool]
1506+ show_origin : Optional[bool]
1507+ show_scope : Optional[bool]
1508+ get_color : Optional[Union[str, bool]]
1509+ get_colorbool : Optional[Union[str, bool]]
1510+ default : Optional[str]
1511+ _type : "bool", "int", "bool-or-int", "path", "expiry-date", "color"
1512+ edit : Optional[bool]
1513+ no_includes : Optional[bool]
1514+ includes : Optional[bool]
1515+ add : Optional[bool]
1516+
1517+ Examples
1518+ --------
1519+ >>> git = Git(dir=git_local_clone.dir)
1520+
1521+ >>> git.config()
1522+ 'usage: git config ...'
1523+
1524+ >>> git.config(_list=True)
1525+ '...user.email=...'
1526+
1527+ >>> git.config(get='color.diff')
1528+ 'auto'
1529+ """
1530+ local_flags : list [str ] = []
1531+
1532+ if replace_all is True :
1533+ local_flags .append ("--replace-all" )
1534+
1535+ if get is not None and isinstance (get , str ):
1536+ local_flags .extend (["--get" , get ])
1537+
1538+ if get_regexp is not None and isinstance (get_regexp , str ):
1539+ local_flags .extend (["--get-regexp" , get_regexp ])
1540+
1541+ if get_all is not None and isinstance (get_all , str ):
1542+ local_flags .extend (["--get-all" , get_all ])
1543+
1544+ if get_urlmatch is not None and isinstance (get_urlmatch , tuple ):
1545+ local_flags .extend (["--get-urlmatch=" , * get_urlmatch ])
1546+
1547+ if unset is not None and isinstance (unset , str ):
1548+ local_flags .extend (["--unset" , unset ])
1549+
1550+ if unset_all is not None and isinstance (unset_all , str ):
1551+ local_flags .extend (["--unset-all" , unset_all ])
1552+
1553+ if _list is True :
1554+ local_flags .append ("--list" )
1555+
1556+ if fixed_value is True :
1557+ local_flags .append ("--fixed-value" )
1558+
1559+ if no_type is True :
1560+ local_flags .append ("--no-type" )
1561+
1562+ if null is True :
1563+ local_flags .append ("--null" )
1564+
1565+ if name_only is True :
1566+ local_flags .append ("--name-only" )
1567+
1568+ if show_origin is True :
1569+ local_flags .append ("--show-origin" )
1570+
1571+ if show_scope is True :
1572+ local_flags .append ("--show-scope" )
1573+
1574+ if edit is True :
1575+ local_flags .append ("--edit" )
1576+
1577+ if system is True :
1578+ local_flags .append ("--system" )
1579+
1580+ if local is True :
1581+ local_flags .append ("--local" )
1582+
1583+ if worktree is True :
1584+ local_flags .append ("--worktree" )
1585+
1586+ if remove_section is True :
1587+ local_flags .append ("--remove-section" )
1588+
1589+ if rename_section is True :
1590+ local_flags .append ("--rename-section" )
1591+
1592+ if _type is not None and isinstance (_type , str ):
1593+ local_flags .extend (["--type" , _type ])
1594+
1595+ if blob is not None and isinstance (blob , str ):
1596+ local_flags .extend (["--blob" , blob ])
1597+
1598+ if file is not None :
1599+ local_flags .extend (["--file" , str (file )])
1600+
1601+ if default is True :
1602+ local_flags .append ("--default" )
1603+
1604+ if includes is True :
1605+ local_flags .append ("--includes" )
1606+
1607+ if no_includes is True :
1608+ local_flags .append ("--no-includes" )
1609+
1610+ if add is True :
1611+ local_flags .append ("--add" )
1612+
1613+ if get_colorbool is not None :
1614+ if isinstance (get_colorbool , str ):
1615+ local_flags .extend (["--get-colorbool" , get_colorbool ])
1616+ else :
1617+ local_flags .append ("--get-colorbool" )
1618+
1619+ if get_color is not None :
1620+ if isinstance (get_color , str ):
1621+ local_flags .extend (["--get-color" , get_color ])
1622+ else :
1623+ local_flags .append ("--get-color" )
1624+
1625+ return self .run (
1626+ ["config" , * local_flags ],
1627+ check_returncode = False ,
1628+ )
0 commit comments