Skip to content

Commit

Permalink
add fie
Browse files Browse the repository at this point in the history
  • Loading branch information
pourmand1376 committed Aug 10, 2023
1 parent be72ca3 commit 7253953
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions obsidian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ echo "This script is used to facilitate configuration of git for obsidian. "

HOME_PATH="/data/data/com.termux/files/home"
DOWNLOAD_FOLDER="$HOME_PATH/storage/shared/Download"

OBSIDIAN_SCRIPT="
function sync_obsidian
{
cd \"$1\"
git add .
git commit -m \"Android Commit\"
git fetch
git merge --no-edit
git add .
git commit -m \"automerge android\"
git push
echo \"Sync is finished\"
sleep 2
}
"

# Define functions for each menu option
function install_required_deps()
{
Expand Down Expand Up @@ -219,22 +236,8 @@ function create_alias_and_git_scripts()
touch "$HOME_PATH/.bashrc"
touch "$HOME_PATH/.obsidian-script"
touch "$HOME_PATH/.profile"
echo '
function sync_obsidian
{
cd "$1"
git add .
git commit -m "Android Commit"
git fetch
git merge --no-edit
git add .
git commit -m "automerge android"
git push
echo "Sync is finished"
sleep 2
}' > "$HOME_PATH/.obsidian-script"
# append this to file only if it is not already there

write_to_file_if_not_exists "$OBSIDIAN_SCRIPT" "$HOME_PATH/.obsidian-script"
write_to_file_if_not_exists "$HOME_PATH/.obsidian-script" "$HOME_PATH/.profile"
write_to_file_if_not_exists "source $HOME_PATH/.profile" "$HOME_PATH/.bashrc"

Expand Down Expand Up @@ -262,6 +265,7 @@ sleep 2
echo "alias $alias='sync_obsidian $HOME_PATH/$folder'" > "$HOME_PATH/.$folder"
write_to_file_if_not_exists "source $HOME_PATH/.$folder" "$HOME_PATH/.profile"
echo "alias $alias created in .$folder"
echo "You should exit the program to see the changes"
}
# Main menu loop
while true; do
Expand Down

0 comments on commit 7253953

Please sign in to comment.