|
import subprocess |
|
import streamlit as st |
|
import os |
|
|
|
def clone_github_repo(repo_url, destination_folder=None): |
|
if destination_folder is None: |
|
destination_folder = repo_url.split('/')[-1].replace('.git', '') |
|
try: |
|
result = subprocess.run(["git", "clone", repo_url, destination_folder], check=True, capture_output=True, text=True) |
|
st.success(f"Repository cloned successfully: {repo_url} -> {destination_folder}") |
|
st.text(result.stdout) |
|
except subprocess.CalledProcessError as e: |
|
st.error(f"Error cloning repository: {e}") |
|
st.text(e.stderr) |
|
|
|
st.title("GitHub Repository Cloner") |
|
repo_url = st.text_input("Enter GitHub Repository URL", "https://github.com/NebulaServices/Nebula") |
|
destination_folder = st.text_input("Enter Destination Folder (Optional)") |
|
|
|
if st.button("Clone Repository"): |
|
clone_github_repo(repo_url, destination_folder) |
|
|
|
|
|
if 'STREAMLIT_PORT' not in os.environ: |
|
os.environ['STREAMLIT_PORT'] = '7860' |
|
|
|
import os |
|
os.system("streamlit run app.py --server.port 7860") |