Skip to content

Commit

Permalink
Improve bash scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
alanvardy committed May 17, 2023
1 parent 78335c6 commit a50b244
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lint_string.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
grep -rE --include="*.rs" "$1" .
if [ $? -eq 0 ]; then

if grep -rE --include="*.rs" "$1" .; then
echo "'$1's found."
exit 1
else
Expand Down
6 changes: 3 additions & 3 deletions manual_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Does not cover the complete function
# Run it manually to ensure that we didn't break clap

Expand Down Expand Up @@ -33,8 +33,8 @@ commands=(
for cmd in "${commands[@]}"
do
echo "Executing command: $cmd"
eval "$cmd"
if [ $? -ne 0 ]; then

if ! eval "$cmd"; then
echo "Command failed: $cmd"
exit 1
fi
Expand Down
13 changes: 7 additions & 6 deletions push_aur.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/sh
cd ../tod-bin/
#!/bin/bash

cd ../tod-bin/ || exit
git pull
cd ../tod/
cd ../tod/ || exit
makepkg --printsrcinfo > ../tod-bin/.SRCINFO
mv PKGBUILD ../tod-bin/
rm *.tar.gz
cd ../tod-bin/
rm ./*.tar.gz
cd ../tod-bin/ || exit
git add .
git commit -m "new version"
git push aur
cd ../tod
cd ../tod || exit
8 changes: 5 additions & 3 deletions setup_aur.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cd ~/dev
#!/bin/bash

cd ~/dev || exit
git clone ssh://[email protected]/tod-bin.git
cd tod-bin
cd tod-bin || exit
git remote add aur ssh://[email protected]/tod-bin.git
cd ../tod
cd ../tod || exit
2 changes: 2 additions & 0 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ pub fn complete_item(config: &Config) -> Result<String, String> {
}

/// Post to Todoist via sync API
/// We use sync when we want natural languague processing.
fn post_todoist_sync(
config: &Config,
url: String,
Expand Down Expand Up @@ -161,6 +162,7 @@ fn post_todoist_sync(
}

/// Post to Todoist via REST api
/// We use this when we want more options and don't need natural language processing
fn post_todoist_rest(
config: &Config,
url: String,
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
cargo fmt &&
cargo clippy -- -D warnings &&
cargo tarpaulin -o lcov &&
Expand Down
2 changes: 1 addition & 1 deletion update_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
cargo update && \
./test.sh && \
./manual_test.sh && \
Expand Down
5 changes: 0 additions & 5 deletions watch.sh

This file was deleted.

0 comments on commit a50b244

Please sign in to comment.