Skip to content

Commit

Permalink
Prepare 0.1.0
Browse files Browse the repository at this point in the history
Clarify a few things in the README.md and add a version macro
that can be used with `-V/--version`.
  • Loading branch information
abbec committed Apr 9, 2024
1 parent 15a5d49 commit 5ac71ee
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ TEST_SOURCES = test/assert.c test/buffer.c test/text.c test/utf8.c test/main.c \
test/minibuffer.c test/undo.c test/settings.c test/container.c

prefix ?= /usr/local
datadir = $(prefix)/share/dged
DESTDIR ?= $(prefix)
datadir = share/dged

.SUFFIXES:
.SUFFIXES: .c .o .d

CFLAGS += -Werror -g -O2 -std=c99 -I $(.CURDIR)/src -I $(.CURDIR)/src/main -DDATADIR="$(datadir)"
CFLAGS += -Werror -g -O2 -std=c99 -I $(.CURDIR)/src -I $(.CURDIR)/src/main -DDATADIR="$(prefix)/$(datadir)"

ASAN ?= false

Expand Down Expand Up @@ -121,14 +122,14 @@ clean:
rm -rf $(.OBJDIR)/grammars

install: dged
install -d $(prefix)/bin
install -m 755 $(.OBJDIR)/dged $(prefix)/bin/dged
install -d $(DESTDIR)/bin
install -m 755 $(.OBJDIR)/dged $(DESTDIR)/bin/dged

install -d $(prefix)/share/man/man1
install -m 644 $(.CURDIR)/dged.1 $(prefix)/share/man/man1/dged.1
install -d $(DESTDIR)/share/man/man1
install -m 644 $(.CURDIR)/dged.1 $(DESTDIR)/share/man/man1/dged.1

install -d $(datadir)/grammars
cp -rL $(.OBJDIR)/grammars "$(datadir)/"
install -d $(DESTDIR)/$(datadir)/grammars
cp -rL $(.OBJDIR)/grammars "$(DESTDIR)/$(datadir)/"

docs:
doxygen $(.CURDIR)/Doxyfile
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ GNU Emacs and only implement the things I need to be productive.

The editor was created as a learning exercise and to create something that I
can use as a daily driver. If anyone else happens to find it useful I will
be flattered and suprised.
be very flattered and surprised.

DGED is in early development so bugs and breaking changes are to be
expected pre-1.0.0.

## Features

Expand All @@ -17,6 +20,7 @@ be flattered and suprised.
- [x] Absolutely no plugin system
- [x] Terminal only
- [x] Mouse-free editing
- [x] Naive and incorrect unicode handling
- [ ] LSP Client implementation

## Contributing
Expand All @@ -25,7 +29,7 @@ Contributions are of course welcome. Please open a PR on the Github repository.

## Development Setup

The editor is built using BSD make so that needs to be installed.
The editor is built using BSD make (specifically bmake) so that needs to be installed.

To enable syntax highlighting (default) you will also need the tree-sitter library
installed.
Expand All @@ -36,6 +40,7 @@ needed dependencies, issue:
```
$ nix develop
```

Currently, tree-sitter grammars can only be automatically fetched when using the Nix setup.

To build the editor, first create the build folder
Expand All @@ -44,6 +49,12 @@ To build the editor, first create the build folder
$ mkdir -p build
```

or

```
$ mkdir -p obj
```

Then call make

```
Expand Down Expand Up @@ -72,7 +83,7 @@ followed by
# make install
```

Optionally, you can set `prefix` to a value of your liking.
Optionally, you can set `prefix` (and `DESTDIR`) to a value of your liking.

## Documentation

Expand Down
14 changes: 12 additions & 2 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "bindings.h"
#include "cmds.h"
#include "completion.h"
#include "version.h"

static struct frame_allocator frame_allocator;

Expand Down Expand Up @@ -121,25 +122,34 @@ void update_file_watches(struct reactor *reactor) {
}
}

void usage() {
static void usage() {
printf("dged - a text editor for datagubbar/datagummor!\n");
printf("usage: dged [-l/--line line_number] [-e/--end] [-h/--help] "
"[filename]\n");
}

static void version() {
printf("dged - %s\n© Albert Cervin 2024\n", DGED_VERSION);
}

int main(int argc, char *argv[]) {

static struct option longopts[] = {{"line", required_argument, NULL, 'l'},
{"end", no_argument, NULL, 'e'},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}};

const char *filename = NULL;
uint32_t jumpline = 1;
bool goto_end = false;
char ch;
while ((ch = getopt_long(argc, argv, "hel:", longopts, NULL)) != -1) {
while ((ch = getopt_long(argc, argv, "Vhel:", longopts, NULL)) != -1) {
switch (ch) {
case 'V':
version();
return 0;
break;
case 'l':
jumpline = atoi(optarg);
break;
Expand Down
6 changes: 6 additions & 0 deletions src/main/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef _VERSION_H
#define _VERSION_H

#define DGED_VERSION "dev"

#endif

0 comments on commit 5ac71ee

Please sign in to comment.