Skip to content

Commit

Permalink
Move license message into a command
Browse files Browse the repository at this point in the history
  • Loading branch information
wonghang committed Sep 27, 2019
1 parent 751cc13 commit 7672420
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# h5browser
h5browser.py - A lightweight HDF5 browser

h5browser.py is a great HDF5 file browser and manipulation tool for command-line lovers.
h5browser.py is a useful HDF5 file browser and manipulation tool for command-line lovers.

# History

Expand Down Expand Up @@ -39,7 +39,7 @@ $ wget https://support.hdfgroup.org/ftp/HDF5/examples/files/exbyapi/h5ex_t_float
$ ./h5browser.py h5ex_t_float.h5
```

All groups and datasets are similar to that of a Linux shell. Groups are like directories and dataset are like files.
All groups and datasets are similar to that of a Linux shell. Groups are like directories and datasets are like files.

```
Opening h5ex_t_float.h5 (read-only)...
Expand Down Expand Up @@ -191,7 +191,7 @@ You can also do some simple calculations using numpy inside h5browser.py
1.97959184 2. ]
```

To delete a data, use `rm` like Unix shell:
To delete a dataset, use `rm` like Unix shell:

```
/new_group# rm X
Expand Down Expand Up @@ -241,15 +241,15 @@ Opening /tmp/a.h5 (read-write)...

# Manual

Type `help` to get a list of all commands:
Type `help` to get a list of all commands and obtain their usage

```
/$ help
Documented commands (type help <topic>):
========================================
EOF cd eval help mkdir print quit readwrite ro
cat dump exit ls p pwd readonly rm rw
EOF cd eval help ls p pwd readonly rm rw
cat dump exit license mkdir print quit readwrite ro
/$ help dump
dump (path) - Dump a dataset (as list) to the screen. (It may take some time if the dataset is too big)
Expand Down
25 changes: 13 additions & 12 deletions h5browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,9 @@ def complete_cd(self,text,line,begidx,endidx):
complete_rm=complete_cd
complete_mkdir=complete_cd

if __name__ == '__main__':
try:
path = sys.argv[1]
except IndexError:
sys.stderr.write("%s (hdf5 file path)\n" % sys.argv[0])
sys.exit(1)

intro = """h5browser.py - A lightweight HDF5 browser
def do_license(self,argv):
"""license - Print BSD license"""
txt = """h5browser.py - A lightweight HDF5 browser
Copyright (c) 2019, Wong Hang <[email protected]>
All rights reserved.
Expand Down Expand Up @@ -378,7 +373,13 @@ def complete_cd(self,text,line,begidx,endidx):
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

print(intro)
b = h5browser(path)
b.cmdloop()
print(txt)

if __name__ == '__main__':
try:
path = sys.argv[1]
except IndexError:
sys.stderr.write("%s (hdf5 file path)\n" % sys.argv[0])
sys.exit(1)
else:
h5browser(path).cmdloop()

0 comments on commit 7672420

Please sign in to comment.