k4d3 commited on
Commit
e4e3dcb
1 Parent(s): e50a215

install_members

Browse files

Signed-off-by: Balazs Horvath <[email protected]>

Files changed (2) hide show
  1. .zshrc +1 -0
  2. zsh/install_members.zsh +27 -0
.zshrc CHANGED
@@ -918,6 +918,7 @@ filePath = '$filePath'
918
  print(json.loads(safetensors.safe_open(filePath, 'np').metadata().get('ss_seed', 'Not found')))"
919
  }
920
 
 
921
  source ~/toolkit/zsh/gallery-dl.zsh
922
  source ~/toolkit/zsh/png2mp4.zsh
923
 
 
918
  print(json.loads(safetensors.safe_open(filePath, 'np').metadata().get('ss_seed', 'Not found')))"
919
  }
920
 
921
+ source ~/toolkit/zsh/install_members.zsh
922
  source ~/toolkit/zsh/gallery-dl.zsh
923
  source ~/toolkit/zsh/png2mp4.zsh
924
 
zsh/install_members.zsh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/zsh
2
+
3
+ install_members() {
4
+ # Read the Cargo.toml file and extract the members
5
+ # The awk command extracts the lines between 'members = [' and ']'
6
+ # The sed command removes the first and last lines (which are '[' and ']')
7
+ # It also removes quotes, commas, and comments, and deletes empty lines
8
+ members=$(awk '/members = \[/,/\]/' Cargo.toml | sed -e '1d;$d' -e 's/[",]//g' -e 's/#.*//g' -e '/^\s*$/d')
9
+
10
+ # Convert the members string into an array
11
+ members_array=(${(f)members})
12
+
13
+ # Loop through each member and run the cargo install command
14
+ for member in $members_array; do
15
+ # Trim leading and trailing whitespace from each member
16
+ member=$(echo $member | xargs)
17
+ echo "Processing $member..."
18
+ # Change to the member's directory
19
+ # If the directory change fails, print an error message and exit the function
20
+ cd $member || { echo "Failed to enter directory $member"; return 1; }
21
+ # Run the cargo install command with the specified options
22
+ cargo install -Z build-std --target x86_64-unknown-linux-gnu --path .
23
+ # Return to the previous directory
24
+ cd ..
25
+ done
26
+ }
27
+