This commit is contained in:
		
							
								
								
									
										28
									
								
								scripts/1.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								scripts/1.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
# Define the directory containing Portainer Stack Markdown files
 | 
			
		||||
markdown_dir = "./docs/proxmox"
 | 
			
		||||
 | 
			
		||||
# Define the relative path prefix used in mkdocs.yml
 | 
			
		||||
relative_path_prefix = "proxmox/"
 | 
			
		||||
 | 
			
		||||
# Generate navigation entries
 | 
			
		||||
nav_entries = []
 | 
			
		||||
for filename in os.listdir(markdown_dir):
 | 
			
		||||
    if filename.endswith(".md"):
 | 
			
		||||
        title = filename[:-3]  # Remove ".md" extension
 | 
			
		||||
        relative_path = f"{relative_path_prefix}{filename}"  # Generate relative path
 | 
			
		||||
        nav_entries.append(f"    - {title}: {relative_path}")  # Add 4 spaces
 | 
			
		||||
 | 
			
		||||
# List of names to ignore
 | 
			
		||||
names_to_ignore = ["template"]  # Add names you want to ignore here
 | 
			
		||||
 | 
			
		||||
# Filter out entries to ignore
 | 
			
		||||
filtered_nav_entries = [entry for entry in nav_entries if not any(name in entry for name in names_to_ignore)]
 | 
			
		||||
 | 
			
		||||
# Sort the navigation entries alphabetically (case-insensitive)
 | 
			
		||||
sorted_nav_entries = sorted(filtered_nav_entries, key=lambda entry: entry.lower())
 | 
			
		||||
 | 
			
		||||
# Print the sorted navigation entries with 4 spaces
 | 
			
		||||
for entry in sorted_nav_entries:
 | 
			
		||||
    print(entry)
 | 
			
		||||
							
								
								
									
										25
									
								
								scripts/git.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								scripts/git.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
import os
 | 
			
		||||
import subprocess
 | 
			
		||||
import argparse
 | 
			
		||||
 | 
			
		||||
# Define and parse command-line arguments
 | 
			
		||||
parser = argparse.ArgumentParser(description="Automate Git add, commit, and push operations.")
 | 
			
		||||
parser.add_argument("--COMMIT-MSG", help="Commit message for the changes.")
 | 
			
		||||
args = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
# Get the commit message from command-line argument or prompt user
 | 
			
		||||
if args.COMMIT_MSG:
 | 
			
		||||
    commit_msg = args.COMMIT_MSG
 | 
			
		||||
else:
 | 
			
		||||
    commit_msg = input("Enter commit message: ")
 | 
			
		||||
 | 
			
		||||
# Add changes to the staging area
 | 
			
		||||
subprocess.run(["git", "add", "."], check=True)
 | 
			
		||||
 | 
			
		||||
# Commit changes
 | 
			
		||||
subprocess.run(["git", "commit", "-m", commit_msg], check=True)
 | 
			
		||||
 | 
			
		||||
# Push changes
 | 
			
		||||
subprocess.run(["git", "push"], check=True)
 | 
			
		||||
 | 
			
		||||
print("Changes have been added, committed, and pushed.")
 | 
			
		||||
		Reference in New Issue
	
	Block a user