mud-git 1.0.2__tar.gz → 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ on:
6
6
  - 'v*.*.*'
7
7
 
8
8
  jobs:
9
- build:
9
+ deploy:
10
10
  runs-on: ubuntu-latest
11
11
 
12
12
  steps:
@@ -1,17 +1,39 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.1
2
2
  Name: mud-git
3
- Version: 1.0.2
4
- Summary: 🗃️ Multi repository git utility. Manage multiple git-repositories simultaneously.
3
+ Version: 1.0.3
4
+ Summary: Multi repository git utility. Manage multiple git-repositories simultaneously.
5
+ Author-email: Jasur Sadikov <jasur@sadikoff.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Jasur Sadikov
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
5
28
  Project-URL: Homepage, https://github.com/jasursadikov/mud
6
29
  Project-URL: Issues, https://github.com/jasursadikov/mud/issues
7
- Author-email: Jasur Sadikov <jasur@sadikoff.com>
8
- License-File: LICENSE
30
+ Classifier: Programming Language :: Python :: 3
9
31
  Classifier: License :: OSI Approved :: MIT License
10
32
  Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: Python :: 3
12
33
  Requires-Python: >=3.12
13
- Requires-Dist: prettytable
14
34
  Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: prettytable
15
37
 
16
38
  # mud
17
39
 
@@ -1,13 +1,14 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
2
+ requires = ["hatchling", "setuptools-scm"]
3
+ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mud-git"
7
- version = "1.0.2"
7
+ dynamic = ["version"]
8
8
  authors = [{ name = "Jasur Sadikov", email = "jasur@sadikoff.com" }]
9
- description = "🗃️ Multi repository git utility. Manage multiple git-repositories simultaneously."
9
+ description = "Multi repository git utility. Manage multiple git-repositories simultaneously."
10
10
  readme = "README.md"
11
+ license = { file = "LICENSE" }
11
12
  requires-python = ">=3.12"
12
13
  classifiers = [
13
14
  "Programming Language :: Python :: 3",
@@ -16,15 +17,16 @@ classifiers = [
16
17
  ]
17
18
  dependencies = ["prettytable"]
18
19
 
19
- [project.urls]
20
- Homepage = "https://github.com/jasursadikov/mud"
21
- Issues = "https://github.com/jasursadikov/mud/issues"
20
+ [tool.setuptools_scm]
21
+ version_scheme = "no-guess-dev"
22
+ local_scheme = "no-local-version"
22
23
 
23
24
  [tool.hatch.build.targets.wheel]
24
25
  packages = ["src/mud"]
25
26
 
26
- [tool.hatch.version]
27
- path = "src/mud/__about__.py"
28
-
29
27
  [project.scripts]
30
28
  mud = "mud:run"
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/jasursadikov/mud"
32
+ Issues = "https://github.com/jasursadikov/mud/issues"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -54,14 +54,14 @@ class App:
54
54
  parser.add_argument(*DIVERGED_ATTR, action='store_true', help='Filters repositories with diverged branches.')
55
55
  parser.add_argument(*ASYNC_ATTR, action='store_true', help='Switches asynchronous run feature.')
56
56
  parser.add_argument(SET_GLOBAL[0], help=f'Sets {BOLD}.mudconfig{RESET} in the current repository as your fallback {BOLD}.mudconfig{RESET}.', action='store_true')
57
- parser.add_argument(VERSION[0], help='Displays the current version of mud.', action='store_true')
58
57
  parser.add_argument('catch_all', nargs='*', help='Type any commands to execute among repositories.')
59
58
  return parser
60
59
 
61
60
  def run(self) -> None:
62
61
  # Displays default help message
63
62
  if len(sys.argv) == 1 or sys.argv[1] in HELP:
64
- utils.version()
63
+ utils.info()
64
+ print()
65
65
  self.parser.print_help()
66
66
  return
67
67
  # Sets global repository in .mudsettings
@@ -72,10 +72,6 @@ class App:
72
72
  utils.settings.save()
73
73
  print(f'Current {BOLD}.mudconfig{RESET} set as a global configuration.')
74
74
  return
75
- # Prints version
76
- elif sys.argv[1] in VERSION:
77
- utils.version()
78
- return
79
75
  # Runs configuration wizard
80
76
  elif sys.argv[1] in CONFIGURE:
81
77
  utils.configure()
@@ -10,11 +10,10 @@ STATUS = ['status', 'st']
10
10
  BRANCHES = ['branch', 'branches', 'br']
11
11
  REMOTE_BRANCHES = ['remote-branch', 'remote-branches', 'rbr']
12
12
  HELP = ['help', '--help', '-h']
13
- VERSION = ['--version', '-v', 'version']
14
13
  CONFIGURE = ['configure', 'config']
15
14
  SET_GLOBAL = ['--set-global']
16
15
 
17
- COMMANDS = [ADD, REMOVE, LOG, INFO, INIT, TAGS, LABELS, STATUS, BRANCHES, REMOTE_BRANCHES, HELP, VERSION, CONFIGURE, SET_GLOBAL]
16
+ COMMANDS = [ADD, REMOVE, LOG, INFO, INIT, TAGS, LABELS, STATUS, BRANCHES, REMOTE_BRANCHES, HELP, CONFIGURE, SET_GLOBAL]
18
17
 
19
18
  # Filters
20
19
  ASYNC_ATTR = '-a', '--async'
@@ -11,7 +11,7 @@ from mud.styles import *
11
11
 
12
12
 
13
13
  class Runner:
14
- _label_color_cache = {}1
14
+ _label_color_cache = {}
15
15
  _current_color_index = 0
16
16
 
17
17
  def __init__(self, repos):
@@ -8,7 +8,6 @@ from prettytable import PrettyTable, PLAIN_COLUMNS
8
8
 
9
9
  from mud.settings import *
10
10
  from mud.styles import *
11
- from mud.__about__ import __version__
12
11
 
13
12
  SETTINGS_FILE_NAME = '.mudsettings'
14
13
  CONFIG_FILE_NAME = '.mudconfig'
@@ -20,25 +19,18 @@ def glyphs(key: str) -> str:
20
19
  return GLYPHS[key][0 if settings.config['mud'].getboolean('nerd_fonts', fallback=False) else 1]
21
20
 
22
21
 
23
- def version() -> None:
22
+ def info() -> None:
24
23
  os.chdir(os.path.dirname(os.path.abspath(__file__)))
25
- logo = get_logo()
26
- info = f'Jasur Sadikov <jasur@sadikoff.com>\nhttps://github.com/jasursadikov/mud\n{BOLD}{random.choice(TEXT[3:])}{__version__}{RESET}'
27
- print(logo)
28
- print(info)
29
-
30
-
31
- def get_logo() -> str:
32
24
  colors = TEXT[3:]
33
25
  colors.remove(BRIGHT_WHITE)
34
26
  m = random.choice(colors)
35
27
  u = random.choice(colors)
36
28
  d = random.choice(colors)
37
- logo = f' {d}__{RESET}\n'
38
- logo += f' {m}__ _ {u}__ __{d}___/ /{RESET}\n'
39
- logo += f' {m}/ \' \\{u}/ // / {d}_ /{RESET}\n'
40
- logo += f'{m}/_/_/_/{u}\\_,_/{d}\\_,_/ {RESET}'
41
- return logo
29
+ print(f' {d}__{RESET}')
30
+ print(f' {m}__ _ {u}__ __{d}___/ /{RESET}')
31
+ print(f' {m}/ \' \\{u}/ // / {d}_ /{RESET}')
32
+ print(f'{m}/_/_/_/{u}\\_,_/{d}\\_,_/ {RESET}')
33
+ print(f'Jasur Sadikov <jasur@sadikoff.com>\nhttps://github.com/jasursadikov/mud')
42
34
 
43
35
 
44
36
  def configure() -> None:
@@ -56,23 +48,17 @@ def configure() -> None:
56
48
 
57
49
 
58
50
  def ask(text: str) -> bool:
59
- print(f'{text} [Y/n] ', end='', flush=True)
60
- if sys.platform.startswith('win'):
61
- from msvcrt import getch
62
- response = getch().decode().lower()
63
- else:
64
- import tty
65
- import termios
66
- fd = sys.stdin.fileno()
67
- old_settings = termios.tcgetattr(fd)
68
- try:
69
- tty.setraw(fd)
70
- response = sys.stdin.read(1).lower()
71
- finally:
72
- termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
73
-
74
- print()
75
- return response in ['y', '\r', '\n']
51
+ try:
52
+ answer = input(f"{text}? [Y/n]: ").strip().lower()
53
+ if answer in ('y', 'yes', ''):
54
+ return True
55
+ elif answer in ('n', 'no'):
56
+ return False
57
+ else:
58
+ print("Invalid input.")
59
+ return True
60
+ except KeyboardInterrupt:
61
+ exit()
76
62
 
77
63
 
78
64
  def print_table(table: PrettyTable) -> None:
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.1
2
+ Name: mud-git
3
+ Version: 1.0.3
4
+ Summary: Multi repository git utility. Manage multiple git-repositories simultaneously.
5
+ Author-email: Jasur Sadikov <jasur@sadikoff.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Jasur Sadikov
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/jasursadikov/mud
29
+ Project-URL: Issues, https://github.com/jasursadikov/mud/issues
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Operating System :: OS Independent
33
+ Requires-Python: >=3.12
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: prettytable
37
+
38
+ # mud
39
+
40
+ ![Version](https://img.shields.io/pypi/v/mud-git?logo=python)
41
+ ![Build Status](https://img.shields.io/github/actions/workflow/status/jasursadikov/mud/test.yaml?logo=github)
42
+ ![Pulbish](https://img.shields.io/github/actions/workflow/status/jasursadikov/mud/publish.yaml?logo=github)
43
+
44
+ ![Demo](./img.png)
45
+
46
+ mud is a multi-directory git runner which allows you to run git commands in a multiple repositories. It has multiple powerful tools filtering tools and support of aliasing. This tool is not limited to git commands only, you can run any commands as you wish, but this tool was primarily designed to be used with git, so each referenced directory should have `.git`.
47
+
48
+ ## Installing
49
+ ```bash
50
+ pip install mud-git
51
+ ```
52
+
53
+ ## Getting started
54
+
55
+ 1. Run `mud config` to start interactive wizard which help you to set the preferable settings. Check [settings](#settings) section for more. At the end, `.mudsettings` file will appear at your home directory that you can alter in the future.
56
+ 2. Locate to your preferable directory with repositories.
57
+ 3. Run `mud init` command to create `.mudconfig` file. This file is important to keep references to repositories. All repositories in current dictionary would be included to `.mudconfig`.
58
+ 4. Optional: Run [`mud --set-global`](#global-mudconfig) to make current configuration default and reachable from any directory.
59
+
60
+ All entries are stored in `.mudconfig` in TSV format. After making your first entry, you can open `.mudconfig` in a text editor and modify it according to your needs.
61
+
62
+ ### Global .mudconfig
63
+ - `mud --set-global` - sets current `.mudconfig` as a global configuration, so it would be used as a fallback configuration to run from any directory.
64
+
65
+ ## Using
66
+
67
+ ### Commands
68
+ `mud <FILTER> <COMMAND>` will execute bash command across all repositories. To filter repositories check [arguments](#arguments) section.
69
+
70
+ - `mud info`/`mud i` - displays branch divergence and working directory changes.
71
+ - `mud status`/`mud st` - displays working directory changes.
72
+ - `mud log`/`mud l` - displays latest commit message, it's time and it's author.
73
+ - `mud labels`/`mud lb` - displays mud labels across repositories.
74
+ - `mud branch`/`mud br` - displays all branches in repositories.
75
+ - `mud remote-branch`/`mud rbr` - displays all branches in repositories.
76
+ - `mud tags`/`mud t` - displays git tags in repositories.
77
+
78
+ ### Arguments
79
+ - `-l=<label>` or `--label=<label>` - includes repositories with provided label.
80
+ - `-nl=<label>` or `--not-label=<label>` - excludes repositories with provided label.
81
+ - `-b=<branch>` or `--branch=<branch>` - includes repositories with provided branch.
82
+ - `-nb=<branch>` or `--not-branch=<branch>` - excludes repositories with provided label.
83
+ - `-c` or `--command` - explicit command argument. Use this whenever you're trying to run a complex command.
84
+ - `-m` or `--modified` - filters out modified repositories.
85
+ - `-d` or `--diverged` - filters repositories with diverged branches.
86
+ - `-t` or `--table` - toggles default table view setting for run.
87
+ - `-a` or `--async` - toggles asynchronous run feature.
88
+
89
+ Example:
90
+
91
+ ```bash
92
+ mud -b=master -d git pull
93
+ # Filters out all repos with master branch and diverged branches and then runs pull command.
94
+ ```
95
+
96
+ ## Settings
97
+
98
+ Settings are stored in your home directory in `.mudsettings` file.
99
+
100
+ - `run_async = 0/1` - enables asynchronous commands.
101
+ - `run_table = 0/1` - enables asynchronous commands in a table view. Requires `run_async`.
102
+ - `nerd_fonts = 0/1` - use nerd fonts in the output 💅.
103
+ - `show_borders = 0/1` - enables borders in table view.
104
+ - `collapse_paths = 0/1` - simplifies branch name in the branch view.
105
+ - `config_path = /home/user/path/.mudconfig` - this is set up by `mud --set-global` [command](#global-mudconfig).
106
+
107
+ ### Aliases
108
+
109
+ You can create your own aliases for commands. To create your own aliases, edit .mudsettings file, `[alias]` section. .mudsettings has the following aliases by default:
110
+
111
+ ```ini
112
+ [alias]
113
+ to = git checkout
114
+ fetch = git fetch
115
+ pull = git pull
116
+ push = git push
117
+ ```
118
+
119
+ ## Labeling
120
+
121
+ You can modify your .mudconfig file by using following commands:
122
+
123
+ ### Adding and labeling repositories
124
+
125
+ - `mud add <label> <path>` - adds path with an optional label.
126
+ - `mud add <path>` - adds path without a label.
127
+
128
+ ### Removing labels and repositories
129
+
130
+ - `mud remove <label>` - removes label from all directories.
131
+ - `mud remove <path>` - removes directory with a specified path.
132
+ - `mud remove <label> <path>` - removes label from a directory.
@@ -0,0 +1,22 @@
1
+ .gitignore
2
+ LICENSE
3
+ README.md
4
+ img.png
5
+ pyproject.toml
6
+ requirements.txt
7
+ .github/workflows/publish.yaml
8
+ .github/workflows/test.yaml
9
+ src/mud/__init__.py
10
+ src/mud/app.py
11
+ src/mud/commands.py
12
+ src/mud/config.py
13
+ src/mud/runner.py
14
+ src/mud/settings.py
15
+ src/mud/styles.py
16
+ src/mud/utils.py
17
+ src/mud_git.egg-info/PKG-INFO
18
+ src/mud_git.egg-info/SOURCES.txt
19
+ src/mud_git.egg-info/dependency_links.txt
20
+ src/mud_git.egg-info/entry_points.txt
21
+ src/mud_git.egg-info/requires.txt
22
+ src/mud_git.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mud = mud:run
@@ -0,0 +1 @@
1
+ prettytable
@@ -0,0 +1 @@
1
+ mud
@@ -1 +0,0 @@
1
- __version__ = "1.0.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes