Skip to content

shipping a repl #481

Open
Open

Description

@crazymonkyyy

I offered this code to opend; it would need adr's code to compile here(or shipping a file watching method in Phobos), but for parity you can have it as well

/*
repl

run dlang.io like gists
the `--- foo.d` thing
*/

import std;
enum tempfolder=".__gist/";
auto dropmap(alias F,R)(R r,int i){
	foreach(j;0..i){
		F(r.front);
		r.popFront;
	}
	return r;
}
void watchfile(F)(string file, F func){
	import arsd.core;
	auto w = new DirectoryWatcher(FilePath("."),file,false,(path, op) {
		if(path.path==file){
			func();
	}});
	getThisThreadEventLoop().run(() => false);
}
void exe(string s)=>executeShell(s).output.writeln;
void main(string[] args){
	assert(args.length>1,"gib file");
	watchfile(args[1],(){
		File temp;
		string command;
		exe("mkdir "~tempfolder);
		foreach(l;File(args[1]).byLine.dropmap!((s){command=s.dup;})(1)){
			if(l.length>3 && l[0..3]=="---"){
				//"opening:".writeln(l);
				temp=File((tempfolder~l[3..$].strip).to!string,"w");
			} else {
				temp.writeln(l);
			}
		}
		temp.close;
		exe("cd "~tempfolder~";"~command);
		exe("rm -rf "~tempfolder);
	});
}

Activity

  1. added
    Type.EnhancementAn improvement to an existing functionality
    Prio.3.NormalA bug that is neither a blocker nor a regression
    on Jun 21, 2025
  2. crazymonkyyy commented on Jun 29, 2025

    @crazymonkyyy
    Author

    https://github.com/dlang-community/drepl

    ~(X)dub
    zsh: command not found: dub
    (127)~(X)yay dub
    16 aur/perl-dublincore-record 0.03-1 (+0 0.00) 
        Container for Dublin Core metadata elements
    15 aur/perl-marc-crosswalk-dublincore 0.02-1 (+0 0.00) 
        Convert data between MARC and Dublin Core
    14 aur/python-pydub-git 0.25.1.r9.g996cec4-1 (+0 0.00) 
        Manipulate audio with a simple and easy high level interface
    13 aur/otr-verwaltung3p-vdub 1.0.0-1 (+0 0.00) (Orphaned) 
        Preconfigured wine prefix with ffdshow for otr-verwaltung3p
    12 aur/ardublock Update1026-1 (+1 0.00) 
        Physical computing with Arduino as easy as drag-and-drop
    11 aur/python-baidubce 0.9.35-1 (+1 0.00) 
        BCE SDK for python
    10 aur/krillinai-bin 1.2.1-1 (+1 0.57) 
        A video translation and dubbing tool powered by LLMs, offering professional-grade translations and one-click full-process deployment.It can generate content optimized for platforms like YouTube,TikTok, and Shorts.(Prebuilt version)
    9 aur/draci-historie-dubbing-cz 1.0-2 (+3 0.00) 
        Czech voices for the first Czech CD-ROM-based 2D point-and-click adventure game
    8 aur/workspace-d 3.5.0-1 (+6 0.00) (Out-of-date: 2024-02-29) 
        Wraps dcd, dfmt and dscanner to one unified environment managed by dub
    7 aur/openav-sorcer-git 1.1.2.r2.g2e1a600-1 (+6 0.00) (Orphaned) (Out-of-date: 2024-01-07) 
        A wavetable LV2 plugin synth, targeted at the electronic / dubstep genre
    6 aur/dublin-traceroute 0.4.2-1 (+0 0.00) (Orphaned) 
        NAT-aware multipath tracerouting tool
    5 aur/tal-plugins 20140826-1 (+15 0.00) (Orphaned) 
        Togu Audio Line VST plugins - NoiseMaker, Dub III, Filter, Filter II, Reverb, Reverb II, Reverb III, Vocoder II - ported and compiled for Linux
    4 aur/python-pydub 0.25.1-6 (+18 1.80) 
        Manipulate audio with a simple and easy high level interface
    3 aur/dub-git 1.11.0.alpha.1.r11.2cbab87-1 (+5 0.00) (Orphaned) 
        Package manager for D packages, git version
    2 arcolinux_repo/arcolinux-lxdm-theme-minimalo-git 23.06-01 (62.2 KiB 122.5 KiB) 
        Simple ArcoLinux theme for LXDM, by Thayer Williams and Allan McRae and Erik Dubois
    1 extra/dub 1.40.0-1 (1.3 MiB 4.7 MiB) [dlang] 
        Developer package manager for D programming language
    ==> Packages to install (eg: 1 2 3, 1-3 or ^4)
    ==> 1
    Sync Explicit (1): dub-1.40.0-1
    [sudo] password for monkyyy: 
    resolving dependencies...
    looking for conflicting packages...
    
    Package (1)  New Version  Net Change  Download Size
    
    extra/dub    1.40.0-1       4.69 MiB       1.32 MiB
    
    Total Download Size:   1.32 MiB
    Total Installed Size:  4.69 MiB
    
    :: Proceed with installation? [Y/n] 
    :: Retrieving packages...
     dub-1.40.0-1-x86_64                                                                                       1355.0 KiB  1892 KiB/s 00:01 [----------------------------------------------------------------------------------] 100%
    (1/1) checking keys in keyring                                                                                                          [----------------------------------------------------------------------------------] 100%
    (1/1) checking package integrity                                                                                                        [----------------------------------------------------------------------------------] 100%
    (1/1) loading package files                                                                                                             [----------------------------------------------------------------------------------] 100%
    (1/1) checking for file conflicts                                                                                                       [----------------------------------------------------------------------------------] 100%
    (1/1) checking available disk space                                                                                                     [----------------------------------------------------------------------------------] 100%
    :: Processing package changes...
    (1/1) installing dub                                                                                                                    [----------------------------------------------------------------------------------] 100%
    :: Running post-transaction hooks...
    (1/1) Arming ConditionNeedsUpdate...
    ~(X)dub drepl
    USAGE: dub [--version] [<command>] [<options...>] [-- [<application arguments...>]]
    
           Error Unknown command: drepl
    
    (1)~(X)dub installdrepl
    USAGE: dub [--version] [<command>] [<options...>] [-- [<application arguments...>]]
    
           Error Unknown command: installdrepl
    
    (1)~(X)dub install drepl
    USAGE: dub [--version] [<command>] [<options...>] [-- [<application arguments...>]]
    
           Error Unknown command: install
    
    (1)~(X)dub fetch drepl  
        Fetching drepl 0.2.1
         Fetched package drepl successfully
    1 packages fetched, 0 already present, 0 failed
    ~(X)dub run drepl  
                 Building package drepl in /home/monkyyy/.dub/packages/drepl/0.2.1/drepl/
        Fetching libdparse 0.8.7 (getting selected version)
        Fetching linenoise 1.1.0+1.0.0 (getting selected version)
        Fetching colorize 1.0.5 (getting selected version)
        Fetching stdx-allocator 2.77.2 (getting selected version)
        Starting Performing "debug" build using /usr/bin/ldc2 for x86_64.
        Building colorize 1.0.5: building configuration [library]
        Building stdx-allocator 2.77.2: building configuration [library]
        Building libdparse 0.8.7: building configuration [library]
    .dub/packages/libdparse/0.8.7/libdparse/src/dparse/stack_buffer.d(76,19): Deprecation: `this.arr[i]` has no effect
            return arr[i];
                      ^
        Building drepl 0.2.1: building configuration [console]
       Pre-build Running commands
    cc1: fatal error: C/linenoise.c: No such file or directory
    compilation terminated.
    Error Command failed with exit code 1: cd /home/monkyyy/.dub/packages/drepl/0.2.1/drepl; [ -f C/linenoise.o ] || cc -c -fPIC -o C/linenoise.o C/linenoise.c
    (2)~(X)
    

    its been broken for a while and it was bloated when it worked

  3. rikkimax commented on Jun 29, 2025

    @rikkimax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Prio.3.NormalA bug that is neither a blocker nor a regressionType.EnhancementAn improvement to an existing functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions