Skip to content

Commit

Permalink
feat: add discus
Browse files Browse the repository at this point in the history
Discus aims to make df prettier, with features such as color, graphs, and smart formatting of numbers

Log: add discus
Issue: deepin-community/sig-deepin-sysdev-team#62
Influence: source files of discus would be added
  • Loading branch information
Diamond-Fur authored and deepin-ci-robot committed Jul 4, 2023
1 parent 711d1ce commit 69c0093
Show file tree
Hide file tree
Showing 34 changed files with 2,023 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
12 changes: 12 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Current Author
----------
Nicolas Carrier ([email protected])

Main Author
-----------
Stormy Henderson ([email protected] or [email protected])

Contributors
------------
John Soward is helping with the FreeBSD port.
Aaron Marasco fixed a color bug.
340 changes: 340 additions & 0 deletions COPYING

Large diffs are not rendered by default.

123 changes: 122 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,122 @@
# template-repository
# Discus

## Overview

Discus is a program to display hard drive space usage, much like the standard
UNIX command df.

Discus aims to make df(1) prettier.
Features include color, bar graphs, and smart formatting of numbers
(automatically choosing the most suitable size from kilobytes, megabytes,
gigabytes, or terabytes). Or choose your own size, along with specifying the
number of decimal places you'd like to see.

To configure Discus on a system-wide basis, edit the **/etc/discusrc** file.
But you should probably change things just for yourself, by copying
**/etc/discusrc** to **~/.discusrc** and editing that.

The source code is contained in the discus.py file itself, as it is a Python
code encapsulated in a shell script.

Stormy Henderson, the original author, said:

> Yes, I chose the name Discus because of the similarity to "disk use."
> And no, I didn't misspell discuss.
> A discus is a round thingie people throw.
Newest versions of Discus may be found at:
https://github.com/ncarrier/discus

## Dependencies

Python 3.6 or above.

## Usage

Usually:

```
./discus.py
```

should be sufficient.

Please do:

```
./discus.py --help
```

for more information.

## Installation

```
cp discus.py /usr/local/bin
chmod a+rx /usr/local/bin/discus
cp discusrc /etc
chmod a+r /etc/discusrc
gzip -9 discus.1
cp discus.1.gz /usr/local/man/man1
chmod a+r /usr/local/man/man1/discus.1.gz
```

## Development

### Required packages

Command to install development packages for debian 10 and 11:

```
sudo apt install flake8 moreutils
```

### Unit tests

Only a few unit tests exist at the time of writing, but one has to start
somewhere :)

```
PYTHONPATH=. python3 -m unittest tests.unit_tests -v
```

### Pre-commit tests

The `tests/pre-commit.sh` script allows to perform tests prior of committing.
You can run it directly or even better, install it as a git hook script by
running:

```
ln -s ../../tests/pre-commit.sh .git/hooks/pre-commit
```

## Coding style

The source code follows the PEP8 coding style, which can be checked with, for
example, the `flake8` or the `pep8` command-line tools in debian.

## Known bugs

These problems remain unfixed as of this release:

* RedHat 6.0 Commerce with RH 6.1 Python outputs all zeros (reported by
Jerrad Pierce)
* The known bugs list hasn't been checked :)

## To do

Simple things I'm considering adding to Discus:

* A cleaner config file format, using argparse, deprecating the former
discusrc file format.
* Configure bash auto-completion.
* Choose your own column labels.
* Compact option to squeeze in everything including device name.
* A Makefile for non-Debian users, or rather, setuptools support.

Complicated things I'm considering adding to Discus:

* Add du(1) functionality to combine both disk usage functions into
one software package.

Want your wish added? Please open an issue.
51 changes: 51 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
VERSION 0.5.0 -----
o Fix for issue https://github.com/ncarrier/discus/issues/1
o A discusrc file isn't mandatory anymore


VERSION 0.4.0 ----- March 13th, 2020
o More standard return statuses, 64, for usage error, 78 for config
o Display width adapted to the terminal size
o Ignore silently statvfs permission errors


VERSION 0.3.0 ----- March 27th, 2020

o Python 3 compatibility.
o dropped support for the stat_prog configuration option


VERSION 0.2.9 ----- September 15th, 2000

o Fixed a color bug (thanks to Aaron Marasco).
o Added mention of the configuration files in the README.


VERSION 0.2.8 ----- September 15th, 2000

o Colors may be altered in the configuration file.


VERSION 0.2.7 ----- September 13th, 2000

o May define your own graph characters in config file.
o Fixed bug with reserved space that caused falsely inflated disk space
usage to be reported.


VERSION 0.2.4 ----- September 13th, 2000

o Added /etc/discusrc and $HOME/.discusrc configuration files.

o Will fall back to using the external stat program if the statvfs
module is unavailable.

o May use shell commands to obtain mounts information. An example is
provided in the config file using /bin/mount with awk.

o May specify your own labels for KB/MB/GB/TB in config file.


VERSION 0.2.2 ----- September 12th, 2000

o First public release.
Loading

0 comments on commit 69c0093

Please sign in to comment.