-4

How give a app NAME instead of "sudo sails lift"? own app Name or commandline? How can I create a own app name instead of this "sails lift" and without the boat (graphic) there, when do you lift the app?

How to create a own commandline for sails app? like app name etc? I get this every time.. but I want change it to a own graphic with out the boat and sails lift? how doing that and where?

info: Starting app...

info: 
info:                .-..-.
info: 
info:    Sails              <|    .-..-.
info:    v0.11.5             |\
info:                       /|.\
info:                      / || \
info:                    ,'  |'  \
info:                 .-'.-==|/_--'
info:                 `--'-------' 
info:    __---___--___---___--___---___--___
info:  ____---___--___---___--___---___--___-__
info: 
info: Server lifted in `/Users/cyberspace/Documents/Apps/www.project.com/project/myapp`
info: To see your app, visit http://localhost
info: To shut down Sails, press <CTRL> + C at any time.
halfer
  • 19,824
  • 17
  • 99
  • 186
space odyssey
  • 51
  • 2
  • 6
  • You can always change the code in sails but it will be erased with an `npm install`... you can also launch with `node app.js` and add your custom message after clearing the console http://stackoverflow.com/questions/9006988/node-js-on-windows-how-to-clear-console – M-A. Fernandes May 02 '16 at 15:19
  • me too here! it's only a start script.. but i have a app gitlist OS here : https://github.com/SpaceG/gitlist.io and make me fit for this : a sails.js developer say me that. please, have take a look : http://sailsjs.org/documentation/concepts/programmatic-usage and google about - " Configuring, starting and stopping Sails apps programmatically in node.js" – space odyssey May 02 '16 at 20:57
  • i have one : here download : tilda https://github.com/SpaceG/gitlist.io/blob/master/cli.js then create a cli.js file. then in your https://github.com/SpaceG/gitlist.io/blob/master/package.json and these stips
      "bin": {
        "gitlist": "./cli.js"
      },  
    see the tree example : https://github.com/SpaceG/gitlist.io don't forget the gitgnore : https://github.com/SpaceG/gitlist.io/blob/master/.gitignore
    – space odyssey May 03 '16 at 07:26
  • someone have a idea? now? I'm stuck here since some days. – space odyssey May 06 '16 at 01:26

1 Answers1

1

There is a complete overview on how to run a Sails app via a script on the Sails doc site, under programmatic usage, as well as a full reference of the Sails application object in the application section. Between those two there are more than enough examples to let you build your own command-line app, which can be as simple as:

#!/usr/bin/env node
// Make sure that no matter where we call the command from,
// we lift the app that lives in the same directory as this script
process.chdir(__dirname);
// Get an instance of Sails
var sails = require('sails');
// Lift the Sails app in the current working directory
sails.lift();

If you want to get rid of the initial ship message, you can set sails.config.log.noShip to true:

sails.lift({log:{noShip: true}});

You can also take a shortcut by just copying the app.js file that comes with every new Sails project and adding #!/usr/bin/env node to the top of it. Either way, make sure your CLI script is executable:

chmod +x ./myapp
sgress454
  • 24,870
  • 4
  • 74
  • 92
  • OK : NEW CHANGES : i have left the app.js blank (however why?) ... and but that code example of you: in that cli.js file. : it works... Now with the Commandline $ sudo gitlist lift but i want to understanding why.... ?... thats ipmortant when do you learning to Code Apps. But Thanks alot Mr. sgress454 – space odyssey May 08 '16 at 03:37