Skip to main content

A tool for quickly ceating a New File form a Template

Project description

A python script for quickly ceating a New File form a Template

Installing

Simply clone this repository into a directory that you won’t accidentally delete or move. I would recommend putting it in ~/ . Navigate to the newly created directory can run the following commands:

$ chmod a+x ./install
$ ./install

This will prompt you with a few commands to fill out the templates with your information. In order to source your bash profile, it’ll ask you to login again. If this makes you uncomfortable, you can ‘^C’ and run the source command manually with:

$ source ~/.bash_profile

Running

Just like that, we should be in business. Now work something like the Touch command but instead of creating empty files, when Will create basic boilerplate files from the template. Try it out with something like:

$ nft test.java

Which created the folowing file:

/*-------------------------------------
test.java
project
    by Daniel Richards (ddrichar@ucsc.edu)
       on 4-9-2018
--------------------------------------*/

import java.util.*;
import java.lang.*;
import java.io.*;

public class test
{
        public static void main(String args[])
        {
                System.out.println("New Java file created from template")
        }
}

Other File Types

NFT can also build non-source files. The standard README is included in the templates and he can be run with:

$ nft README

But the real coup de grace is the makefiles. NFT can build makefiles for Java and C projects and can even make a jar package. NFT will compile files beforehand to catch any nested classes that don’t correspond .java files. Run the makefile script with:

$ nft Makefile

Adding Templates

Also not as simple as the install, adding templates it’s quite easy. In new_from_template.py you’ll find a dictionary called file_types. Add an entry to the dictionary with the key (language name) and value (file extention). Next, in the ./templates sub-directory add a file named .. For instance if you wanted to add a C++ template, you could do something like:

file_types[C++]=cpp

Using the other templates as a reference, add specific replace wildcards for the program i.e. .

Authors

CAUTION

As with any install from source, it is important to read it over and I understand what the code is doing. Pay special attention bash scripts as well as any process calls in the Python scripts i.e. Popen, open, write or subproces. By design, this program will edit system files so if you don’t understand what a command is doing, check the docs.

License

This project is unlicensed and in the Public Domain with the sole provision that if you make anything cool with my code, I want to know about it!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nft-1.6.tar.gz (6.4 kB view details)

Uploaded Source

File details

Details for the file nft-1.6.tar.gz.

File metadata

  • Download URL: nft-1.6.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.7.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for nft-1.6.tar.gz
Algorithm Hash digest
SHA256 4bdb9138d73a701f75ed064a102ff8f8ece638ff7d10afa718eca82f4736fc1a
MD5 5df0b11bc6109310362175104b36e9dc
BLAKE2b-256 0adddaadaa13ed1001a7bcee3dda17fc0ac92c4718c0d23feb0adc3e12eac28b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page