Skip to content

Commit

Permalink
Test with help dialogue
Browse files Browse the repository at this point in the history
  • Loading branch information
apcamargo authored Dec 24, 2024
1 parent 1670333 commit 79f3add
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion recipes/pdb2fasta/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -euo

mkdir -p ${PREFIX}/bin
${CC} ${CFLAGS} pdb2fasta.c -o pdb2fasta
${CC} -O2 pdb2fasta.c -o pdb2fasta
mv pdb2fasta ${PREFIX}/bin
2 changes: 1 addition & 1 deletion recipes/pdb2fasta/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ requirements:

test:
commands:
- pdb2fasta
- pdb2fasta --help

about:
home: "https://github.com/kad-ecoli/pdb2fasta"
Expand Down
34 changes: 33 additions & 1 deletion recipes/pdb2fasta/pdb2fasta.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
diff --git a/pdb2fasta.c b/pdb2fasta.c
index 9642d03..f197f1f 100644
index 9642d03..9e8eef1 100644
--- a/pdb2fasta.c
+++ b/pdb2fasta.c
@@ -1,3 +1,4 @@
+#include<stdlib.h>
#include<stdio.h>
#include<string.h>

@@ -99,14 +100,24 @@ char *pdb2fasta(char *pdb_file){
}

int main(int argc, char** argv){
- if (argc<2){
- printf("pdb2fasta pdb.pdb > seq.fasta\n");
- printf(" convert PDB file pdb.pdb to FASTA sequence file seq.fasta\n");
+ if (argc < 2){
+ printf("Usage: pdb2fasta pdb.pdb > seq.fasta\n");
+ printf(" Convert PDB file pdb.pdb to FASTA sequence file seq.fasta\n");
return argc;
}
-
- int i;
- for (i=1;i<argc;i++){
+
+ if (argc == 2 && strcmp(argv[1], "--help") == 0) {
+ printf("Usage: pdb2fasta [options] pdb.pdb\n");
+ printf("Options:\n");
+ printf(" --help Display this help dialogue and exit\n");
+ printf("\nDescription:\n");
+ printf(" Convert a PDB file to a FASTA sequence format. Output is printed to stdout.\n");
+ printf(" Example:\n");
+ printf(" pdb2fasta pdb.pdb > seq.fasta\n");
+ return 0;
+ }
+
+ for (int i=1; i<argc; i++){
char *pdb_file=argv[i];
printf("%s",pdb2fasta(pdb_file));
}

0 comments on commit 79f3add

Please sign in to comment.