Giter VIP home page Giter VIP logo

descriptive.worm's Introduction

descriptive.worm

Handle parameters of your system in a structured way. [WIP]


The goal of this project is to offer a structured way to handle several parameters of your system. Basically you create profiles that contain information of your current setup. Profiles contain the following information:

  • your bash PS1 prompt
  • a path to a file that contains paths that you want to your path
  • a path to a file that contains files that you want to run on startup
  • a path to a file that contains aliases
  • a path to a file that contains commands that you want to run startup

All the profiles that are created are inserted into a config file

[Sample Config File]

[
    {
        "_id": "59e19a7b-baa3-415b-a43e-02c32b144b7d",
        "_name": "main",
        "_isActive": true,
        "_ps1": "->",
        "_pathsFile": "./profiles/main/paths.json",
        "_startupFile": "./profiles/main/startup.json",
        "_aliasesFile": "./profiles/main/aliases.json",
        "_startupCommandsFile": "./profiles/main/startup-commands.json",
        "_extensions": []
    }
]

[Sample Paths File]

[
  "~/project/bin",
  "/usr/bin"
]

[Sample Startup File]

[
  "~/welcome.sh",
  "~/print_memory_usage.sh"
]

[Sample Aliases File]

{
  "CD": "cd",
  "rs": "exec $SHELL"
}

[Sample Startup Commands File]

[
  "neofetch",
  "docker container ls"
]

Profiles can also contain extensions. Each profile can contain multiple extensions.

[Sample Extension Config File]

{
  "_id": "97f8f4bd-9693-47a6-a612-24a2a34d5414",
  "_name": "descriptive.worm.private",
  "_pathsFile": "./profiles/descriptive.worm.private/paths.json",
  "_startupFile": "./profiles/descriptive.worm.private/startup.json",
  "_aliasesFile": "./profiles/descriptive.worm.private/aliases.json",
  "_startupCommandsFile": "./profiles/descriptive.worm.private/startup-commands.json",
  "_extensions": [
  ]
}

descriptive.worm's People

Contributors

alator21 avatar dependabot[bot] avatar

Watchers

 avatar

descriptive.worm's Issues

fish shell

create abstractions so we can export settings for various shells and create an implementation for fish shell

Rewrite in another language

Consider rewriting the app in another(maybe compiled) language, with main benefits the reduction of the size. Try maybe rust?

Binary size

Investigate possible ways to reduce the binary size

Config

Overwrite .env variables from a .env(or json format) structure which will be located inside ~/.config/dworm/

Refactor profile class

I tried creating this method on the AbstractProfile class but ts-node doesn't like it.

calculatePaths(): string[] {
    const pathsFile: PathsFile | null = ((this.pathsFile != null) && new PathsFile(this.pathsFile)) || null;
    const paths: string[] = (pathsFile && pathsFile.paths) || [];

    for (const extension of this.extensions) {
        const extensionConfig: ExtensionConfigFile = new ExtensionConfigFile(extension);
        const extensionProfile: ExtensionProfile = extensionConfig.profile;
        paths.push(...extensionProfile.calculatePaths());
    }
    return paths;
}

I'm getting the following error(probably related link)

TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at extendStatics (/home/.../.../descriptive.worm/src/profile/ExtensionProfile.ts:7:16)

This should be investigated because the current way is an abomination.

Profile class

static calculatePaths(pathsFilePath: string | null, extensions: string[]): string[] {
    const pathsFile: PathsFile | null = ((pathsFilePath != null) && new PathsFile(pathsFilePath)) || null;
    
    const paths: string[] = (pathsFile && pathsFile.paths) || [];
    
    for (const extension of extensions) {
        const extensionConfig: ExtensionConfigFile = new ExtensionConfigFile(extension);
        const extensionProfile: ExtensionProfile = extensionConfig.profile;
        const extensionPathsFilePath: string | null = extensionProfile.pathsFile;
        const extensionExtensions: string[] = extensionProfile.extensions;
        paths.push(...this.calculatePaths(extensionPathsFilePath, extensionExtensions));
    }
    return paths;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.