summary refs log tree commit diff
path: root/pkgs/applications/misc/with-shell/default.nix
blob: cf52d194f6172657fc281bc225699cf470295ee8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ lib
, stdenv
, fetchFromGitHub
, installShellFiles
}:

stdenv.mkDerivation rec {
  pname = "with";
  version = "unstable-2018-03-20";

  src = fetchFromGitHub {
    owner = "mchav";
    repo = "With";
    rev = "28eb40bbc08d171daabf0210f420477ad75e16d6";
    hash = "sha256-mKHsLHs9/I+NUdb1t9wZWkPxXcsBlVWSj8fgZckXFXk=";
  };

  nativeBuildInputs = [ installShellFiles ];

  installPhase = ''
    runHook preInstall
    install -D with $out/bin/with
    installShellCompletion --bash --name with.bash with.bash-completion
    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://github.com/mchav/With";
    description = "Command prefixing for continuous workflow using a single tool";
    longDescription = ''
      with is a Bash script that starts an interactive shell with where every
      command is prefixed using <program>.

      For example:

      $ with git
      git> add .
      git> commit -a -m "Commited"
      git> push

      Can also be used for compound commands.

      $ with java Primes
      java Primes> 1
      2
      java Primes> 4
      7

      And to repeat commands:

      $ with gcc -o output input.c
      gcc -o -output input.c>
      <enter>
      Compiling...
      gcc -o -output input.c>

      To execute a shell command proper prefix line with :.

      git> :ls

      You can also drop, add, and replace different commands.

      git> +add
      git add> <some file>
      git add> !commit
      git commit> <arguments and message>
      git commit> -
      git>

      To exit use either :q or :exit.
    '';
    license = licenses.asl20;
    maintainers = with maintainers; [ AndersonTorres ];
    platforms = platforms.unix;
  };
}